# Re: st: User-defined MLE problem: How would you solve this?

 From Richard Williams To statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu Subject Re: st: User-defined MLE problem: How would you solve this? Date Wed, 18 Jun 2008 12:58:20 -0500

```At 11:32 AM 6/18/2008, efeijen@worldbank.org wrote:
```
Below you find the .ado file and the command I used for this problem. However
I know they are not correct, since my setup estimates 2 x-coefficients
defined by the mu1 and mu2 equations, but I only want to estimate one for the
dependent variable j: b_j. What to do such that the intercepts in mu1 and mu2
are different, but b_j are identical?

program LDV
version 9.2
args lnf mu1 mu2 sigma
quietly replace `lnf'=ln(1/(2*_pi*(`sigma'^2)))-(1
/(2*(`sigma'^2))*(\$ML_y1-`mu1'))^2 if \$ML_y1<0
quietly replace `lnf'=ln(1/(2*_pi*(`sigma'^2)))-(1
/(2*(`sigma'^2))*(\$ML_y1-`mu2'))^2 if \$ML_y1>0
quietly replace
`lnf'=ln(normalden(-`mu2',0,`sigma')-normalden(-`mu1',0,`sigma')) if
\$ML_y1==0
end

Stata command: ml model lf LDV (mu1: y=x) (mu2: y=x) (sigma:)
```Perhaps the constraints option would do it.  Try

constraint 1 [#1]x = [#2]x
ml model lf LDV (mu1:  y=x) (mu2: y=x) (sigma:), constraint(1)

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

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