Dear All,
I am trying to build maximum likelihood estimator for conditional logit, with nonlinear constraints on parameters. Until now, I am able to write a method d0 program that has the same results as the `clogit' command in stata.
Now, I am trying to impose nonlinear constraint on parameters, however I am not able to do it.
My maximum likelihood estimator for conditional logit is as below:
program myconditional_logit
args todo b lnL
version 11
tempvar den xb p last
mleval `xb' = `b', eq(1)
quietly{
by strata : egen double `den' = sum(exp(`xb'))
gen double `p' = exp(`xb')/`den'
mlsum `lnL' = $ML_y1*log(`p') if $ML_y1==1
if (`todo'==0 | `lnL' > =.) exit
}
end
ml model d0 myconditional_logit (Eq1: choice = x1 x2 x3 x4 x5 x6 x7 x8 , nocons)
Here, what I need to impose is that ;
constraint : [choice]_x2/[choice]_x3 = [choice]_x4 / [choice]_x5
Is there anyone who can help me with imposing this, or can suggest me a source I can look and try to do it ?
Any help would be appreciated.
Thank you for your help,
Sinem
I am trying to build maximum likelihood estimator for conditional logit, with nonlinear constraints on parameters. Until now, I am able to write a method d0 program that has the same results as the `clogit' command in stata.
Now, I am trying to impose nonlinear constraint on parameters, however I am not able to do it.
My maximum likelihood estimator for conditional logit is as below:
program myconditional_logit
args todo b lnL
version 11
tempvar den xb p last
mleval `xb' = `b', eq(1)
quietly{
by strata : egen double `den' = sum(exp(`xb'))
gen double `p' = exp(`xb')/`den'
mlsum `lnL' = $ML_y1*log(`p') if $ML_y1==1
if (`todo'==0 | `lnL' > =.) exit
}
end
ml model d0 myconditional_logit (Eq1: choice = x1 x2 x3 x4 x5 x6 x7 x8 , nocons)
Here, what I need to impose is that ;
constraint : [choice]_x2/[choice]_x3 = [choice]_x4 / [choice]_x5
Is there anyone who can help me with imposing this, or can suggest me a source I can look and try to do it ?
Any help would be appreciated.
Thank you for your help,
Sinem
Comment