 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Maximum likelihood estimation of a probit with free variance and constrained coefficient

 From Stas Kolenikov To statalist@hsphsun2.harvard.edu Subject Re: st: Maximum likelihood estimation of a probit with free variance and constrained coefficient Date Wed, 7 Mar 2012 10:59:40 -0500

```Martin,

you need to give better starting values. -ml- by default tries to
start from a zero vector, so any division by `sigma' results in a
division by zero which gives missing values. Set your sigma parameter
to 1, or give -ml- the whole vector of coefficients to start from.

On Wed, Mar 7, 2012 at 5:49 AM, Martin Nybom <martin.nybom@sofi.su.se> wrote:
> Hello,
>
> I want to use maximum likelihood to estimate a probit with "free" variance
> coefficient (or sigma). I want to have a coefficient parameter for one of
> the independent variables (denoted beta_hat) as constraint, so that
> identification is possible. This beta_hat I have from an earlier step of a
> "structural" model. I have used the following synthetic data set to try to
> make the ml routine for this to work:
>
> ************************
>
> clear all
> program define syndata
>    version 12.0
>    args obs
>    qui      {
>        set obs `obs'
>        gen x1 = uniform()*4
>        gen x2 = uniform()*2 - 1
>        gen e = logit(uniform())
>        scalar b0 = -2
>        scalar b1 = 1
>        scalar b2 = 2
>        gen y_1 = scalar(b0) + scalar(b1)*x1 + scalar(b2)*x2 + e
>        gen pr_y = invlogit(scalar(b0) + scalar(b1)*x1 + scalar(b2)*x2 + e)
>        gen y = (pr_y>=0.5)
>        }
>    end
>
> *************************
>
> And then the ml code proceeds as follows:
>
> *************************
>
> syndata 1000
>
> set more off
> constraint define 1 x2 = 2
> global ML_y1 `y'
> cap program drop probit2_lf
> program define probit2_lf
> version 12.0
> args lnf xb sigma
> tempvar lnlj
> qui     {
>    gen double `lnlj' = ln(normal( `xb'/`sigma')) if \$ML_y1 == 1
>    replace    `lnlj' = ln(normal(-`xb'/`sigma')) if \$ML_y1 == 0
>    replace `lnf' = `lnlj'
>    }
> end
>
> ml model lf probit2_lf (y = x1 x2) /sigma, constraints(1)
> ml maximize
>
> ***************************
>
> This however doesn't work. The iterations give the "not concave" message
> directly from iteration 1. Since the model is simple and there shouldn't be
> any problem with the data, I suspect that I have a problem either somewhere
> in the coding or with how I write down the likelihood functions. I have
> tried the option "offset()" and also putting the ", constraint(1)" directly
> after the equation. Then I get the message the "could not calculate
> numerical derivatives - discontinuous region with missing values
> encountered". Any help on this is highly appreciated!
>
>
> Martin Nybom
>
> --
> Martin Nybom
> Institute for Social Research
> Stockholm University
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

--
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```