--- On Fri, 29/1/10, Dan MacNulty wrote:
> Thanks for the helpful suggestions. I'd like to try your
> splogit_lf program, but can you explain how I store the
> variable to be turned into a spline in the global sp?
In the example below is illustrated how to use it (though
it does not converge to a meaningful maximum).
*----------------- begin example -----------------------------
program define splogit_lf
version 8.2
args lnf xb b1 b2 k
tempvar eta
qui gen double `eta' = `xb' + `b1'*$sp + `b2'*max($sp-`k', 0)
qui replace `lnf' = ln(invlogit(`eta')) if $ML_y1 == 1
qui replace `lnf' = ln(invlogit(-`eta')) if $ML_y1 == 0
end
sysuse auto, clear
global sp mpg
ml model lf splogit_lf (foreign=price) /b1 /b2 /k
ml search
ml maximize
*-------------------- end example --------------------------------
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/