Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Maarten Buis <maartenlbuis@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Error when testing for interactions and using the trtest command |
Date | Wed, 11 Sep 2013 16:16:23 +0200 |
The problem is that you cannot use likelihood ratio tests in combination with (cluster) robust standard error estimates: http://www.stata.com/support/faqs/statistics/likelihood-ratio-test/ Why are you using -xi- in combination with -regress-? I suggest you use the new factor variable notation (see: -help fvvarlist-). -- Maarten On Wed, Sep 11, 2013 at 3:46 PM, Amal Khanolkar <Amal.Khanolkar@ki.se> wrote: > Hi all, > > I'm trying to test for interaction as follows (my idea is that the association between the outcome variable - syst - and bwtgestage_sd varies between the different categories of ethnicity_bi2x): > > > xi: regress syst i.ethnicity_bi2x*bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1, cluster (mor_lopnr) > estimates store A > xi: regress syst i.ethnicity_bi2x bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1, cluster (mor_lopnr) > lrtest A > > The above runs normally but however I get a msg that the suffix cluster as specified does not work with lrt. Is there any other way to test this? > > . xi: regress syst i.ethnicity_bi2x*bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1, cluster (mor_lopnr) > i.ethnicity_~2x _Iethnicity_1-3 (naturally coded; _Iethnicity_1 omitted) > i.eth~2x*bwtg~d _IethXbwtge_# (coded as above) > i.conscript_o~e _Iconscript_1-5 (naturally coded; _Iconscript_1 omitted) > i.education _Ieducation_1-4 (naturally coded; _Ieducation_1 omitted) > > Linear regression Number of obs = 407329 > F( 15,341887) = 1945.87 > Prob > F = 0.0000 > R-squared = 0.0678 > Root MSE = 10.684 > > (Std. Err. adjusted for 341888 clusters in mor_lopnr) > ------------------------------------------------------------------------------- > | Robust > syst | Coef. Std. Err. t P>|t| [95% Conf. Interval] > --------------+---------------------------------------------------------------- > _Iethnicity_2 | -.2617723 .1109874 -2.36 0.018 -.4793044 -.0442402 > _Iethnicity_3 | -3.656168 .2233399 -16.37 0.000 -4.093908 -3.218429 > bwtgestage_sd | -.6332801 .0183192 -34.57 0.000 -.6691852 -.5973751 > _IethXbwtge_2 | .2514268 .1124746 2.24 0.025 .0309798 .4718738 > _IethXbwtge_3 | .418909 .2255315 1.86 0.063 -.0231262 .8609442 > age | .2786778 .0376159 7.41 0.000 .2049517 .3524039 > byear | .1489301 .0040085 37.15 0.000 .1410736 .1567866 > _Iconscript_2 | -3.088915 .0486329 -63.51 0.000 -3.184234 -2.993596 > _Iconscript_3 | 2.077029 .0529613 39.22 0.000 1.973226 2.180831 > _Iconscript_5 | -2.657567 .0466754 -56.94 0.000 -2.749049 -2.566084 > bmi | .5763755 .0056062 102.81 0.000 .5653875 .5873636 > height_cons | .1653572 .0027697 59.70 0.000 .1599287 .1707858 > _Ieducation_2 | .0167756 .0475646 0.35 0.724 -.0764496 .1100009 > _Ieducation_3 | .1032984 .060617 1.70 0.088 -.0155092 .2221059 > _Ieducation_4 | .100287 .0585597 1.71 0.087 -.0144883 .2150623 > _cons | -212.092 7.963648 -26.63 0.000 -227.7005 -196.4835 > ------------------------------------------------------------------------------- > > . estimates store A > > . xi: regress syst i.ethnicity_bi2x bwtgestage_sd age byear i.conscript_office bmi height_cons i.education if multibirth==1, cluster (mor_lopnr) > i.ethnicity_~2x _Iethnicity_1-3 (naturally coded; _Iethnicity_1 omitted) > i.conscript_o~e _Iconscript_1-5 (naturally coded; _Iconscript_1 omitted) > i.education _Ieducation_1-4 (naturally coded; _Ieducation_1 omitted) > > Linear regression Number of obs = 407329 > F( 13,341887) = 2244.33 > Prob > F = 0.0000 > R-squared = 0.0678 > Root MSE = 10.684 > > (Std. Err. adjusted for 341888 clusters in mor_lopnr) > ------------------------------------------------------------------------------- > | Robust > syst | Coef. Std. Err. t P>|t| [95% Conf. Interval] > --------------+---------------------------------------------------------------- > _Iethnicity_2 | -.2716162 .1110017 -2.45 0.014 -.4891763 -.0540561 > _Iethnicity_3 | -3.751556 .219569 -17.09 0.000 -4.181904 -3.321207 > bwtgestage_sd | -.6244569 .0180776 -34.54 0.000 -.6598885 -.5890254 > age | .2784561 .0376153 7.40 0.000 .2047313 .3521809 > byear | .1488845 .0040085 37.14 0.000 .1410279 .1567411 > _Iconscript_2 | -3.089462 .0486321 -63.53 0.000 -3.18478 -2.994145 > _Iconscript_3 | 2.077151 .0529625 39.22 0.000 1.973346 2.180956 > _Iconscript_5 | -2.657743 .0466759 -56.94 0.000 -2.749227 -2.56626 > bmi | .5764512 .0056062 102.82 0.000 .5654632 .5874391 > height_cons | .1653702 .0027698 59.70 0.000 .1599414 .1707989 > _Ieducation_2 | .0158461 .0475638 0.33 0.739 -.0773775 .1090697 > _Ieducation_3 | .1018676 .0606147 1.68 0.093 -.0169354 .2206706 > _Ieducation_4 | .0984518 .0585575 1.68 0.093 -.0163192 .2132227 > _cons | -212.0003 7.963748 -26.62 0.000 -227.609 -196.3916 > ------------------------------------------------------------------------------- > > . lrtest A > LR test likely invalid for models with robust vce > r(498); > > > > Thanks, > Amal > > * > * 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/ -- --------------------------------- 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/