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

RE: st: endogenous switching model

Subject   RE: st: endogenous switching model
Date   Mon, 30 Jun 2003 15:02:03 -0500

Dear Renzo,

Thank you very much for taking time to respond to my problem.  I may have not 
written the lf in the right way, but the potential problem that you are 
pointing at does not apply to my case.  What I would like to estimate is an 
endogenous selection, i.e., I don't know the sample selection a priori.  Your 
example applies to the case where the selection is observed, that is, we know 
who is a union worker and who is not a union worker.  But in my sample I don't 
know which managers are entrenched and which are not entrenched.  

Thank you very much,


-----Original Message-----
From: [mailto:owner-] On Behalf Of Renzo Comolli
Sent: Wednesday, June 25, 2003 12:18 AM
Subject: Re: st: endogenous switching model

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

I hope it helps
Renzo Comolli

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


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,


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(
+ (1-norm(

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:

*   For searches and help try:

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