[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Knot optimized logistic regression

From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Knot optimized logistic regression
Date   Fri, 29 Jan 2010 20:32:58 +0000 (GMT)

--- 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

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 L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index