Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: endogenous switching model


From   "Renzo Comolli" <[email protected]>
To   <[email protected]>
Subject   Re: st: endogenous switching model
Date   Wed, 25 Jun 2003 01:18:09 -0400

Dear Ayla,

Unfortunately I cannot fix the code for you, but, by looking at your code,
it seems quite plausible that you haven't understood how -lf- works.
I suggest you consult 
Maximum Likelihood Estimation with Stata
It is very quick to read and master the book if you care only about -lf-

I try now to explain where (I think) your problem lies, but I realize my
explanation is quite obscure (the book does a much better job).
-lf- is written for all those cases in which data are independent. 
Assuming that this is true in your case, -lf- does the sum for you in the
log likelihood, but you have to tell to the procedure which summand it has
to use for each element of the dependent variable vector. Let's make an
example: you have union members and union non members, your loglikelihood is
just sum l(i) but the l(i) is different for members and nonmembers, then you
would just write

quietly replace `lnf' = l(i) if $ML_y1="member"
quietly replace `lnf' = l(i) if $ML_y1="non member"

Of course l(i) contains the theta(s) and it is different for members and non
members

I hope it helps
Renzo Comolli



-----Original Message-----
From: "Ayla Kayhan" <[email protected]>
Subject: st: endogenous switching model
Date: Tue, 24 Jun 2003 17:49:10 -0500

Hi,

I would to estimate an endogenous switching model where the sample
separation is not known (Maddala 1983, 1986). Specifically, I would like
to estimate two sets of parameters for the two regimes where the
observations are endogeneously assigned to one of the two groups (I do
not observe the sample separation). I have specified the maximum
likelihood function but the code I have written is not converging.  I
have tried various starting values including the OLS parameter estimates
that I have obtained from the entire sample, but the ml procedure failed
to converge.

Any ideas as to how I can get this procedure to converge is greatly
appreciated.

Thank you very much,

Ayla

Note:  The following is the program I defined for ml

program define maxim;
version 7.0;

args lnf theta1 theta2 theta3 theta4 theta5 theta6 theta7;

quietly replace
`lnf' = ln(
norm(
(-`theta1'-(`theta3'*($ML_y1-`theta6')/`theta2'^2))
/sqrt(1-(`theta3'^2/`theta2'^2))
)
*normd($ML_y1-`theta4')/`theta2'
+ (1-norm(
(-`theta1'-(`theta5'*($ML_y1-`theta7')/`theta6'^2))
/sqrt(1-(`theta5'^2/`theta6'^2))
))
*normd($ML_y1-`theta7')/`theta6'
);
end;

ml model lf ayla (d5bl = lceoownp lmeddpay loffcc)
()
()
(led5 lcov5 lmbbfd5 lmtob lebitda lppe lsize)
()
()
(led5 lcov5 lmbbfd5 lmtob lebitda lppe lsize pl5bl), robust
cluster(gvkey);


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