# st: constraints and maximum likelihood estimator

 From "Kobes, Deborah" To "'statalist@hsphsun2.harvard.edu'" Subject st: constraints and maximum likelihood estimator Date Tue, 1 Oct 2002 17:53:42 -0400

```I am trying to model a maximum likelihood estimator with two equations,
conditional on the outcome (whether a person moves or stays at their job).
I have a few questions.

1.  I'd like coefficients to be constrained to each other as shown below in
the program, but I get the error: "Constraints invalid: not possible with
test"  Is there any way that I can restrain these coefficients this way?

2.  When I don't constrain the variables, I get this error:
"numerical derivatives are approximate
flat or discontinuous region encountered
Iteration 1:   log likelihood =          0  (not concave)"
It returns values basically equal to 0 for each coefficient, with a log
likelihood of 0.  Is this because the model isn't identified?  Why is it
returning anything?

3.  Are there any obvious problems with my code?  Despite owning the
"Maximum likelihood estimation in Stata" book, I haven't been able to get
too much help with my code, so maybe the problem is unrelated to the things
above.

Thanks!
Deborah Kobes

--------------------------
The program:
--------------------------

constraint define 1 [pnsdif] = [pnselig98_hat]*[earn98_hat]/[earndif];
constraint define 2 [matchdif] = [pnsmatches98_hat]*[earn98_hat]/[earndif];
constraint define 3 [hidif] = [hiesi98_hat]*[earn98_hat]/[earndif];

capture program drop myprobit;
program define myprobit;
args lnf theta theta2;
quietly replace `lnf' = ln(normprob(-`theta')) if \$ML_y1 == 1;
quietly replace `lnf' = ln(normprob(`theta2')) if \$ML_y1 == 0;
end;

ml model lf myprobit (mover = earndif pnsdif matchdif hidif 	ten, nocons)

(earn98_hat pnselig98_hat pnsmatches98_hat hiesi98_hat ten
spesi98 educ1_98 educ2_98 educ3_98 kid98 mar98 un98 unionx98 age98)

[pweight = wgt94], const(1-4);

ml check;
ml search;
ml maximize;
---------------------
*
*   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/
```