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: Re: st: Syntax of –cmp- for a probit model with ordered probit selection


From   <[email protected]>
To   [email protected]
Subject   st: Re: st: Syntax of –cmp- for a probit model with ordered probit selection
Date   Wed, 13 Nov 2013 16:01:14 +0900 (JST)

Dear all,

I use the dataset "laborsup" in http://www.stata-press.com/data/r12/ to reproduce my problem. The codes are

     webuse laborsup,clear
     gen cate_fem_edu=fem_edu
     replace cate_fem_edu=1 if cate_fem_edu<11
     replace cate_fem_edu=2 if cate_fem_edu>=11 & cate_fem_edu<14
     replace cate_fem_edu=3 if cate_fem_edu>=14 
     cmp setup
     gen ind1=cond(cate_fem_edu==1,$cmp_probit,$cmp_out)
     gen ind2=cond(cate_fem_edu==2,$cmp_probit,$cmp_out)
     gen ind3=cond(cate_fem_edu==3,$cmp_probit,$cmp_out)
     cmp (fem_work=kids other_inc) (fem_work=kids other_inc) (fem_work=kids other_inc) (cate_fem_edu=male_educ), ind(ind1 ind2 ind3 $cmp_oprobit)

Here I made female education (fem_edu) become an ordered categorical variable which is valued {1,2,3}. Variable fem_work is a binary variable which shows whether the individual work or not. I estimate the model
      outcome equation: fem_work= b1*"kids other_inc" + u 
      selection equation: cate_fem_edu= b2*male_educ+ v 
I want to estimate the outcome equation with the 3 non-overlap subsample determined by the value of cate_fem_edu.

The estimation result first shows the probit and ordered probit regression for individual models. Then it shows the following message:
     Samples for equations 1 and 2 do not overlap. Removing rho_12 from the model.
     Samples for equations 1 and 3 do not overlap. Removing rho_13 from the model.
     Samples for equations 2 and 3 do not overlap. Removing rho_23 from the model.
     Fitting constants-only model for LR test of overall model fit.
     Equation/parameter /fem_work/ multiply defined
     r(110);

I tried to fix the problem by changing the code into
     cmp (fem_work1=kids other_inc) (fem_work2=kids other_inc) (fem_work3=kids other_inc) (cate_fem_edu=male_educ), ind(ind1 ind2 ind3 $cmp_oprobit)
where fem_work1,2,3 are just the same as fem_work. Then Stata shows
     Samples for equations 1 and 2 do not overlap. Removing rho_12 from the model.
     Samples for equations 1 and 3 do not overlap. Removing rho_13 from the model.
     Samples for equations 2 and 3 do not overlap. Removing rho_23 from the model.
     Fitting constants-only model for LR test of overall model fit.
     initial vector: matrix must be dimension 9
     r(503);

I spent much time to try to figure out what is wrong with my code but still failed.
Does any one know what the problem is and how I can correct it?
I really appreciate your help.

Kuo, Chiu-Wei


--- On Tue, 2013/11/12, [email protected] <[email protected]> wrote:

> Dear Buchanan,
> 
> Thank you so much for your suggestion. I really appreciate your kindly reply.
> 
> After using -set trace on-, I found out that in order to estimate the model
>       outcome equation: outcome_var = b1*var_list1 + u  (outcome_var is a binary variable. )
>       selection equation: selection_var = b2*var_list2 + v  (selection_var is an ordered categorical variable valued {1,2,3})
> the appropriate command should be
>       gen ind1=cond(selection_var ==1, $cmp_probit , $cmp_out)
>       gen ind2=cond(selection_var ==2, $cmp_probit , $cmp_out)
>       gen ind3=cond(selection_var ==3, $cmp_probit , $cmp_out)
>       cmp (outcome_var = var_list1) (outcome_var = var_list1) (outcome_var = var_list1) (selection_var = var_list2), ind(ind1 ind2 ind3 $cmp_oprobit) 
> so that the outcome equation is estimated with the subsample of each category of selection_var.
> 
> However, Stata returns the error message "Equation/parameter /outcome_var/ multiply defined r(110);" after the execution of this command. 
> 
> I also found a post in the past (http://www.stata.com/statalist/archive/2013-03/msg01041.html) in which similar command was used. I am still trying to figure out what is wrong with mine now. I will try to reproduce this problem with some available Stata datasets later.
> 
> Kuo, Chiu-Wei
>  
> --- On Mon, 2013/11/11, William Buchanan <[email protected]> wrote:
> 
> > It may be useful to use -set trace on- to find out exactly where things are breaking down in the code.  If you don't want to dig too far into the code interpretation use -set tracedepth 1- before that (it will show only the higher level commands).  Have you been able to reproduce this problem with other datasets that other users could use to replicate your issue?
> > 
> > Sent from my iPhone
> > 
> > > On Nov 11, 2013, at 5:54, <[email protected]> wrote:
> > > 
> > > Dear Buchanan,
> > > 
> > > Thank you so much for your reply. 
> > > I am sorry that I did not explain my question well.
> > > 
> > > The model I am trying to estimate is 
> > >      outcome equation: outcome_var =b1* var_list1 + u 
> > >      selection equation: selection_var = b2*var_list2 + v 
> > > where outcome_var is a binomial variable, and selection_var is an ordered categorical variable (the categories are labeled from 1 to 7). 
> > > 
> > > Thus I use the command
> > >      cmp (outcome_var = var_list1) (selection_var = var_list2), ind(selection_var*$cmp_probit $cmp_oprobit) 
> > > which estimates the outcome equation with a probit model and the selection equation with an ordered probit model, but Stata keeps showing the error message “Indicator for outcome_var must only evaluate to integers between 0 and 8. r(198);”
> > > 
> > > The exactly same command works well when I use other binary variables to be the selection variable, so I think that there may be some problem in the syntax 
> > >      ind(selection_var*$cmp_probit $cmp_oprobit) 
> > > 
> > > Maybe the syntax should be write in another way when the selection variable is an ordered categorical variable? I try to figure out the correct syntax but failed.
> > > 
> > > 
> > > 
> > >> --- On Mon, 2013/11/11, William Buchanan <[email protected]> wrote:
> > >> 
> > >> If your outcome is binary why would you be using an ordered probit?  And for clarity, I was asking about the outcome variable in any/all equations.
> > >> 
> > >> Sent from my iPhone
> > >> 
> > >>> On Nov 11, 2013, at 5:12, <[email protected]> wrote:
> > >>> 
> > >>> Dear Buchanan,
> > >>> 
> > >>> Thank you so much for your suggestion. 
> > >>> I check the data again, and all the data of the outcome variable is valued 0 or 1. 
> > >>> Do you think there may be any other possible problem?
> > >>> 
> > >>> Kuo, Chiu-Wei
> > >>> 
> > >>>> --- On Mon, 2013/11/11, William Buchanan <[email protected]> wrote:
> > >>>> 
> > >>>> What are the values of your outcome variable?  Are any of the values outside of the 0-8 range indicated by the error message?
> > >>>> 
> > >>>> Sent from my iPhone
> > >>>> 
> > >>>>> On Nov 11, 2013, at 4:53, <[email protected]> wrote:
> > >>>>> 
> > >>>>> Dear Tamas,
> > >>>>> 
> > >>>>> Thank you so much for the suggestion.
> > >>>>> But the same error message still pops out when I put double quotes on the expression.
> > >>>>> (while in the case where the selection variable is a binomial one, the command works well even without double quotes!)
> > >>>>> 
> > >>>>> Do you think there may be any other problem of the syntax?
> > >>>>> 
> > >>>>> Kuo, Chiu-Wei
> > >>>>> 
> > >>>>>> --- On Mon, 2013/11/11, "Bartus Tamás" <[email protected]> wrote:
> > >>>>>> 
> > >>>>>> Dear Kuo, 
> > >>>>>> 
> > >>>>>> Instead of  
> > >>>>>> 
> > >>>>>> ind(selection_var*$cmp_probit $cmp_oprobit) 
> > >>>>>> 
> > >>>>>> try 
> > >>>>>> 
> > >>>>>> ind("selection_var*$cmp_probit" $cmp_oprobit) 
> > >>>>>> 
> > >>>>>> Expressions appearing in the indicators option must be enlosed in double quotes
> > >>>>>> 
> > >>>>>> Tamas
> > >>>>>> 
> > >>>>>>> On 13/11/11, [email protected] wrote: 
> > >>>>>>> 
> > >>>>>>> 
> > >>>>>>> Dear all, 
> > >>>>>>> 
> > >>>>>>> I am trying to estimate the following selection model. 
> > >>>>>>> outcome equation: outcome_var =b1* var_list1 + u 
> > >>>>>>> selection equation: selection_var = b2*var_list2 + v 
> > >>>>>>> where outcome_var is a binomial variable, and selection_var is an ordered categorical variable. 
> > >>>>>>> 
> > >>>>>>> I use the command –cmp- (which can be obtained by –ssc cmp-) to estimate the model. My command is 
> > >>>>>>> cmp (outcome_var = var_list1) (selection_var = var_list2), ind(selection_var*$cmp_probit $cmp_oprobit) 
> > >>>>>>> However, the error message “Indicator for outcome_var must only evaluate to integers between 0 and 8. r(198);” keeps popping out. 
> > >>>>>>> 
> > >>>>>>> I found out that the same error massage appears whenever the selection variable is an ordered categorical variable, while it disappears and the command works normally when the selection variable is a binomial one. 
> > >>>>>>> 
> > >>>>>>> In the paper (“Estimating fully observed recursive mixed-process models with cmp”) written by the –cmp- writer, David Roodman, he mentioned that –cmp- is capable of doing the same estimation as –ssm- and –oheckman- do, so I think that –cmp- is the appropriate command for my model. 
> > >>>>>>> 
> > >>>>>>> I suppose that there is some problem with the part of the syntax, 
> > >>>>>>> ind(selection_var*$cmp_probit $cmp_oprobit) 
> > >>>>>>> I spent much time to figure out what the correct syntax is but still failed. 
> > >>>>>>> I really appreciate it if anyone can point out the problem of my syntax. 
> > >>>>>>> Thank you so much. 
> > >>>>>>> 
> > >>>>>>> Kuo, Chiu-Wei 
> > >>>>>>> 
> > >>>>>>> *
> > >>>>>>> * For searches and help try:
> > >>>>>>> * http://www.stata.com/help.cgi?search
> > >>>>>>> * http://www.stata.com/support/faqs/resources/statalist-faq/
> > >>>>>>> * http://www.ats.ucla.edu/stat/stata/
> > >>>>>> 
> > >>>>>> --
> > >>>>>> 
> > >>>>>> Tamás Bartus, PhD
> > >>>>>> Associate Professor, Deputy Director
> > >>>>>> Institute of Sociology and Social Policy
> > >>>>>> Program Director, Doctoral School of Sociology
> > >>>>>> Corvinus University, Budapest 
> > >>>>>> 1093 Budapest, Közraktár utca 4-6.
> > >>>>>> Room 424.
> > >>>>>> Phone: +36-1-482-7301 
> > >>>>>> Fax: +36-1-482-7348
> > >>>>>> Homepage: http://web.uni-corvinus.hu/bartus
> > >>>>>> 
> > >>>>>> *
> > >>>>>> *   For searches and help try:
> > >>>>>> *   http://www.stata.com/help.cgi?search
> > >>>>>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> > >>>>>> *   http://www.ats.ucla.edu/stat/stata/
> > >>>>> 
> > >>>>> *
> > >>>>> *   For searches and help try:
> > >>>>> *   http://www.stata.com/help.cgi?search
> > >>>>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> > >>>>> *   http://www.ats.ucla.edu/stat/stata/
> > >>>> 
> > >>>> *
> > >>>> *   For searches and help try:
> > >>>> *   http://www.stata.com/help.cgi?search
> > >>>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> > >>>> *   http://www.ats.ucla.edu/stat/stata/
> > >>> 
> > >>> *
> > >>> *   For searches and help try:
> > >>> *   http://www.stata.com/help.cgi?search
> > >>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> > >>> *   http://www.ats.ucla.edu/stat/stata/
> > >> 
> > >> *
> > >> *   For searches and help try:
> > >> *   http://www.stata.com/help.cgi?search
> > >> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> > >> *   http://www.ats.ucla.edu/stat/stata/
> > > 
> > > *
> > > *   For searches and help try:
> > > *   http://www.stata.com/help.cgi?search
> > > *   http://www.stata.com/support/faqs/resources/statalist-faq/
> > > *   http://www.ats.ucla.edu/stat/stata/
> > 
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/help.cgi?search
> > *   http://www.stata.com/support/faqs/resources/statalist-faq/
> > *   http://www.ats.ucla.edu/stat/stata/
> > 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
>


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


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