Statalist


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

st: Re: Emailing: st RE Cappellari and Jenkins code for MSL estimation of a probit model


From   Ousmane FAYE <[email protected]>
To   [email protected]
Subject   st: Re: Emailing: st RE Cappellari and Jenkins code for MSL estimation of a probit model
Date   Tue, 8 Sep 2009 15:52:05 +0300

Hi Nick,
Thank you so much for your help. However, I am still having the same
problem. Please can you clarify a bit what you are suggesting?

Ousmane
Sent from Nairobi, Kenya


On Tue, Sep 8, 2009 at 3:45 PM, Ousmane Faye<[email protected]> wrote:
> From
>
>   "Nick Cox" <[email protected]>
>
> To
>
>   <[email protected]>
>
> Subject
>
>   st: RE: Cappellari and Jenkins code for MSL estimation of a probit model
> for panel data
>
> Date
>
>   Sat, 5 Sep 2009 16:23:22 +0100
>
> ________________________________
>
> The code you run expects a global macro called -id- to be defined, but
> evidently it is empty.
>
>
>
> Nick
>
> [email protected]
>
>
>
> Ousmane FAYE
>
>
>
> I have a probit model using a panel data with 6 waves of observations. I am
> trying to run  the code suggested by Cappellari and Jenkins Stata Journal
> (2006) (Paragraph 3.6: Illustration 4: MSL estimation of a probit model for
> panel data) See below.
>
> However I have the following error message after 'ml maximize' : "varlist
> required."
>
> I use 'ml check' and here is where the error likely happens:
>
>       ......
>
>            - quietly {
>
>               - forvalues i = 1/6 {
>
>               - by $id: gen double `k`i'' = ( 2*$ML_y1[`i'] ) - 1
>
>               = by : gen double __00001J = ( 2*Diarrhea[1] ) - 1
>
> varlist required
>
>                 by $id: gen double `xb`i'' = `theta1'[`i']
>
>                 }
>
>
>
> I have exactly replicate the Cappellari and Jenkins' code. I don't why this
> occurs then. Can someone advise on this issue?
>
> Thanks in advance,
>
>
>
> The program i use is what follows:
>
>
>
>
>
> sort  ChildID update
>
> global cs " "
>
> global csbar " "
>
> forvalues i = 2/6 {
>
>         forvalues j = 1/`i' {
>
>                 global cs "$cs c`i'`j'"
>
>                 global csbar "$csbar  /c`i'`j'"
>
>         }
>
> }
>
> program drop myll
>
> program define myll
>
>      args todo b lnf
>
>      tempvar theta1 T fi xb1 xb2 xb3 xb4 xb5 xb6 k1 k2 k3 k4 k5 k6
>
>      tempname $cs
>
>      mleval `theta1' = `b' , eq(1)
>
>      local c = 1
>
>      forvalues i = 2/6 {
>
>            forvalues j = 1/`i' {
>
>                   local c = `c' + 1
>
>                   mleval `c`i'`j'' = `b' , eq(`c') scalar
>
>            }
>
>      }
>
>      quietly {
>
>              forvalues i = 1/6 {
>
>                    by $ChildID: gen double `k`i'' = ( 2*$ML_y1[`i'] ) - 1
>
>                    by $ChildID: gen double `xb`i'' = `theta1'[`i']
>
>              }
>
>              by $ChildID: gen double `T' = (_n == 6)
>
>              tempname C
>
>              mat `C' = I(6)
>
>              forvalues i = 2/6 {
>
>                     forvalues j = 1/`i' {
>
>                            local c`i'`j' = `c`i'`j''
>
>                            mat `C'[`i',`j'] = (`c`i'`j'')
>
>                     }
>
>              }
>
>              egen `fi' = mvnp(`xb1' `xb2' `xb3' `xb4' `xb5' `xb6') , ///
>
>                  chol(`C') dr($dr) prefix(z) ///
>
>                  signs(`k1' `k2' `k3' `k4' `k5' `k6')
>
>              mlsum `lnf' = ln(`fi') if `T'
>
>        }
>
> end
>
>
>
> di "$cs"
>
> di "$csbar"
>
> probit Diarrhea LDiarrhea LWAZ ChildAge ChildAge2 MotherAge female prim_sch
> sec_sch high_sch
>
> mat b0 = e(b)
>
> mdraws, dr(10) neq(6) prefix(z) antithetics
>
> global dr = r(n_draws)
>
> ml init b0
>
> ml model d0 myll (Diarrhea: Diarrhea = LDiarrhea LWAZ ChildAge ChildAge2
> MotherAge female prim_sch sec_sch high_sch) $csbar
>
> ml maximize
>
>
>
> *
>
> *   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/
>
> ________________________________
>
> References:
>
> st: Cappellari and Jenkins code for MSL estimation of a probit model for
> panel data
>
> From: Ousmane FAYE <[email protected]>
>
> Prev by Date: st: Cappellari and Jenkins code for MSL estimation of a probit
> model for panel data
> Next by Date: st: Using stratified samples in STATA / giving weights
> Previous by thread: st: Cappellari and Jenkins code for MSL estimation of a
> probit model for panel data
> Next by thread: st: Using stratified samples in STATA / giving weights
> Index(es):
>
> Date
> Thread
>
> ________________________________
> ________________________________
>
> © Copyright 1996–2009 StataCorp LP   |   Terms of use   |   Privacy   |
> Contact us   |   What's new   |   Site index
>
>

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index