Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: ml init


From   Martin Heissel <[email protected]>
To   Stata List <[email protected]>
Subject   st: ml init
Date   Fri, 16 Mar 2007 16:20:02 +0100

Hi

I have a problem using the ml init command

I want to estimate a model with a restriction one a coefficient not being negative, using a procedure I found on http://www.stata.com/support/faqs/stat/intconst.html.

But i run into trouble during the 2nd estimation (setting separate equations for the coefficients) with a log-likelihood = -inf

I thought of using the residuals of an intial regression as starting values for sigma, but I cannot figure out how to use the ml init command. Can anyone help?

My program looks like this;

/* begin do file */
    cscript
    program mynormal_d0
            version 9.2
            args todo b lnf
            tempname lnsigma sigma
            tempvar mu 
            mleval `mu' = `b', eq(1)
            mleval `lnsigma' = `b', eq(2) scalar
            quietly {
                    scalar `sigma' = exp(`lnsigma')
                    mlsum `lnf' = ln( normalden($ML_y1,`mu',`sigma') )
            }
    end

use "D:\Stud.ba.oecon\Bachelor Opgave\STATA\datasaetML"     
ml model d0 mynormal_d0 (xb: return_rf = divdum beta d_yield inst_ mv__mil__) (lnsigma:), ///    
diparm(lnsigma, exp label(sigma))  
    ml maximize

    /* end do file */



/* setting separate equations for the coefficients */

/* begin do file */
    cscript
    program mynormal_b
            version 9.2
            args todo b lnf
            tempname a lnsigma sigma
            tempvar xb mu 
            mleval `a' = `b', eq(1) scalar
            mleval `xb' = `b', eq(2)
            mleval `lnsigma' = `b', eq(3) scalar
            quietly {
                    generate double `mu' = `xb' +`a'*$x2
                    scalar `sigma' = exp(`lnsigma')
                    mlsum `lnf' = ln( normalden($ML_y1,`mu',`sigma') )
            }
    end
  
    use "D:\Stud.ba.oecon\Bachelor Opgave\STATA\datasaetML"
    global x2  beta
  
ml model d0 mynormal_b (a: ) (xb: return_rf = divdum d_yield inst_ mv__mil__) (lnsigma:), ///
diparm(lnsigma, exp label(sigma))
ml maximize


    /* end do file */

I thank you for your interest

Best regards
Martin Heissel
stud.bach.oecon
+4520120025
Thorvaldsensgade 11, 1. TH
DK-8000 �rhus C


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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index