Statalist The Stata Listserver


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

st: problems with maximum likelihood


From   "Hui Wang" <[email protected]>
To   [email protected]
Subject   st: problems with maximum likelihood
Date   Wed, 22 Feb 2006 20:11:23 +0000

Hey, I met with several problems when estimating a simutaneous equation
system with maximum likelihood.

Firstly, the ml estimates of the coefficients differ a lot from those got
with 2sls. The coefs of one equation are similar, but the coefs of the other
have been scaled up by about 10000 times. Could anyone give me some idea
about what is going wrong?

Secondly, I tried to use the estimates from the 2sls as initial values for
the ml estimation. The number of parameters in the ml model is exactly the
same as the initial vector I give, but I end up with the following error
message:

**********************************************************************************
initial vector: extra parameter c1 found
specify skip option if necessary
**********************************************************************************

The following is my code:

(md* include 12 variables, dm* include 4 variables)

*****************************************************************************************************************************************************

/*2sls and 3sls*/

global ed(lq lp lakes md*)
global es(lp lq po dm* md*)
xi: reg3 $ed $es, 2sls

matrix coef2sls = e(b)
matrix coef2sls_d_m = coef2sls[1,3..14]
matrix coef2sls_s_dm = coef2sls[1,18..21]
matrix coef2sls_s_m = coef2sls[1,22..33]
matrix myinit =
[_b[lq:lakes],coef2sls_d_m,_b[lq:_cons],_b[lp:po],coef2sls_s_dm,coef2sls_s_m,_b[lp:_cons],_b[lq:lp],_b[lp:lq],1,1,.5]


*xi: reg3 $ed $es,3sls

/*maximum likelihood with endogenous regime - e-m algorithm*/

capture program drop mymlem
program mymlem
version 9.0
args lnf theta1 theta2 alpha1 beta1 sigma1 sigma2 sigma12

tempvar u1 u2 r T Badet f
quietly {
gen double `u1' = $ML_y1 - `theta1' - `alpha1'*lp
gen double `u2' = $ML_y2 - `theta2' - `beta1'*lq
gen double `r' = `sigma12'/(`sigma1'*`sigma2')
gen double `T' =
((`u1'/`sigma1')^2-2*`r'*(`u1'/`sigma1')*(`u2'/`sigma2')+(`u2'/`sigma2')^2)/(2*(1-`r'^2))

gen double `Badet' = abs(1-`alpha1'*`beta1')
gen double `f' =
`Badet'*exp(-`T')/(2*_pi*`sigma1'*`sigma2'*(1-`r'^2)^.5)
replace `lnf' = ln(`f')
}
end

ml model lf mymlem (demand: lq = lakes md*) (supply: lp = po dm* md*)
/alpha1 /beta1 /sigma1 /sigma2 /sigma12
ml init myinit
ml maximize, difficult
***************************************************************************************************************************************************


Thank you all so much!



Best,

Luhang

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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