Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From   Martin Nybom <[email protected]>
To   [email protected]
Subject   st: Maximum likelihood estimation of a probit with free variance and constrained coefficient
Date   Wed, 07 Mar 2012 11:49:46 +0100

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!

Thanks for your consideration!

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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index