Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Klein-Spady semi-parametric estimator


From   "D'Exelle Ben" <[email protected]>
To   <[email protected]>
Subject   st: Klein-Spady semi-parametric estimator
Date   Thu, 9 Mar 2006 10:40:34 +0100

Hi,

Has anyone ever programmed the Klein-Spady semiparametric estimator? I
have tried to do so by creating my own ml program and including a kernel
function; the ml passes all tests but when maximizing the likelihood
function it shows "(non-concave)". Any ideas how to proceed now?

Reference: Klein, R. & R.Spady (1993) "An efficient semiparametric
estimator for discrete choice models", Econometrica, 61, 387-421. Or:
Green (2000: p.847) for the likelihood function.


Here is my code:

program klein_spady_lf

	version 9.1
	args lnf xb
	
	quietly {
	
		tempvar number_yes number_no tmp1 tmp2 Gn

		summarize $ML_y1, meanonly
		gen double `number_yes' = r(mean)
		gen `number_no' = 1 - `number_yes'
				
		kdensity `xb' if $ML_y1==1, nogr gaussian width(.5)
gen(`tmp1') at(`xb')
		kdensity `xb' if $ML_y1==0, nogr gaussian width(.5)
gen(`tmp2') at(`xb')
				
		replace `tmp1' = `tmp1'*`number_yes'
		replace `tmp2' = `tmp2'*`number_no'

		gen double `Gn' = `tmp1'/(`tmp1'+`tmp2')

		replace `lnf' = log(`Gn')/_N   if $ML_y1==1
		replace `lnf' = log(1-`Gn')/_N if $ML_y1==0

	}

end




Ben D'Exelle
 
Institute of Development Policy and Management 
University of Antwerp

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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