Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: Error message when trying to regression model with eststo prefix.


From   Amal Khanolkar <Amal.Khanolkar@ki.se>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Error message when trying to regression model with eststo prefix.
Date   Mon, 11 Feb 2013 13:14:32 +0000

Thanks for the inputs - but problem persists:

. eststo: xi: logistic verypreterm i.ethnicity2 sex byear if magecat!=. & parity!=. & education!=. & famsit_new2!=. & smoke1!=. & multibirth==1, vce (robust)
i.ethnicity2      _Iethnicity_1-22    (naturally coded; _Iethnicity_1 omitted)

Logistic regression                               Number of obs   =    1766026
                                                  Wald chi2(23)   =     358.39
                                                  Prob > chi2     =     0.0000
Log pseudolikelihood = -63492.073                 Pseudo R2       =     0.0026

------------------------------------------------------------------------------
             |               Robust
 verypreterm | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_Iethnici~_2 |   1.098215   .2049259     0.50   0.616     .7618228    1.583145
_Iethnici~_3 |   1.002859   .1235384     0.02   0.982     .7877414    1.276722
_Iethnici~_4 |   .9890319   .2408004    -0.05   0.964     .6137163     1.59387
_Iethnici~_5 |   1.765255   .3048327     3.29   0.001     1.258398    2.476265
_Iethnici~_6 |   1.485207   .1278522     4.59   0.000      1.25462    1.758173
_Iethnici~_7 |   .7250081   .1818284    -1.28   0.200     .4434716    1.185277
_Iethnici~_8 |   1.114882   .1489949     0.81   0.416     .8579709    1.448722
_Iethnici~_9 |   .8845685   .1525027    -0.71   0.477     .6309302    1.240171
_Iethnici~10 |   1.055989   .2317579     0.25   0.804     .6868251    1.623576
_Iethnici~11 |   .7750467    .188535    -1.05   0.295     .4811358    1.248499
_Iethnici~12 |   .9487346   .1232701    -0.41   0.685     .7354399     1.22389
_Iethnici~13 |   1.494765   .1870169     3.21   0.001     1.169701    1.910164
_Iethnici~14 |   1.306816   .2362243     1.48   0.139     .9169563    1.862432
_Iethnici~15 |   1.121471   .2169946     0.59   0.554     .7675174    1.638657
_Iethnici~16 |   1.371584   .2082696     2.08   0.037     1.018523     1.84703
_Iethnici~17 |   1.403515   .3641343     1.31   0.191      .844068    2.333762
_Iethnici~18 |   .5622209   .1563278    -2.07   0.038      .326007    .9695875
_Iethnici~19 |   1.810028   .3975107     2.70   0.007     1.176923    2.783701
_Iethnici~20 |   1.673301   .0567692    15.17   0.000     1.565654    1.788349
_Iethnici~21 |   1.132377     .05108     2.76   0.006      1.03656    1.237051
_Iethnici~22 |   1.523688   .1012357     6.34   0.000     1.337646    1.735605
         sex |   .8768431   .0173419    -6.65   0.000      .843504    .9114999
       byear |   1.000675   .0017452     0.39   0.699     .9972599    1.004101
------------------------------------------------------------------------------
(est1 stored)

. 
end of do-file

. eststo:  logistic verypreterm i.ethnicity2 sex byear if magecat!=. & parity!=. & education!=. & famsit_new2!=. & smoke1!=. & multibirth==1, vce (robust)
factor variables not allowed

The first regression above works when I include the 'xi:' prefix, the exact same regression however does not work when 'xi' is dropped.

I'm running 4 logistic regression models with different confounders and I'm using the eststo command as I would like to get all four models side by side:

eststo clear
eststo: xi: logistic verypreterm i.ethnicity2 sex byear if magecat!=. & parity!=. & education!=. & famsit_new2!=. & smoke1!=. & multibirth==1, vce (robust)
eststo: xi: logistic verypreterm i.ethnicity2 sex byear ib3.magecat i.parity if education!=. & famsit_new2!=. & smoke1!=. & multibirth==1
eststo: xi: logistic verypreterm i.ethnicity2 sex byear ib3.magecat i.parity ib2.education i.famsit_new2 if smoke1!=. & multibirth==1, vce (robust)
eststo: xi: logistic verypreterm i.ethnicity2 sex byear ib3.magecat i.parity ib2.education i.famsit_new2 i.smoke1 if multibirth==1, vce (robust)
esttab, eform ci 


or,

eststo clear
eststo:  logistic verypreterm i.ethnicity2 sex byear if magecat!=. & parity!=. & education!=. & famsit_new2!=. & smoke1!=. & multibirth==1, vce (robust)
eststo:  logistic verypreterm i.ethnicity2 sex byear ib3.magecat i.parity if education!=. & famsit_new2!=. & smoke1!=. & multibirth==1
eststo:  logistic verypreterm i.ethnicity2 sex byear ib3.magecat i.parity ib2.education i.famsit_new2 if smoke1!=. & multibirth==1, vce (robust)
eststo:  logistic verypreterm i.ethnicity2 sex byear ib3.magecat i.parity ib2.education i.famsit_new2 i.smoke1 if multibirth==1, vce (robust)
esttab, eform ci 

Thanks,

Amal Khanolkar
________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Maarten Buis [maartenlbuis@gmail.com]
Sent: 11 February 2013 13:58
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Error message when trying to regression model with eststo prefix.

On Mon, Feb 11, 2013 at 1:38 PM, Amal Khanolkar wrote:
> I'm trying to run the regression model below. I get an error message that says 'factor variables' not allowed.
>
> This is quite strange, given that I ran the exact same regression model last week and had no problems! Can anyone tell me what's going wrong?
>
> . eststo: xi: logistic verypreterm i.ethnicity2 sex byear ib3.magecat i.parity if education!=. & famsit_new2!=. & smoke1!=. & multibirth==1, vce (robust)

It seems that you have two problems:

1) you are mixing -xi:- syntax with factor variable syntax, this is
obviously a very bad idea. The easiest solution is just leave the
-xi:- prefix away and all should work as planned.

2) You have an outdated version of -estout-. So typing in Stata: -ssc
install estout, replace- should solve that problem. The following
works just fine for me:

*------------------ begin example ------------------
sysuse auto, clear
recode rep78 1/2=3
eststo: logit foreign i.rep78##c.trunk turn
esttab
*------------------- end example -------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index