Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Suryadipta Roy <sroy2138@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Comformability error with -margins- |
Date | Thu, 3 Jan 2013 14:45:58 -0500 |
Dear Statalisters, I am having some problems with -margins- and would very much appreciate if someone can help me out. The model is as follows: areg lnimport1 i.importer_gatt##c.icrgm control_variables, absorb(country) robust, where importer_gatt is categorical variable (0/1) and icrgm is a continuous variable (0 - 6). The results with -margins- is below and this will highlight the problem: margins importer_gatt, at(icrgm=0) noestimcheck /* THIS WORKS */ Predictive margins Number of obs = 114749 Model VCE : Robust Expression : Linear prediction, predict() at : icrgm = 0 ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- importer_g~t | 0 | 12.18997 .2452575 49.70 0.000 11.70928 12.67067 1 | 14.28279 .0813169 175.64 0.000 14.12341 14.44216 ------------------------------------------------------------------------------ margins r.importer_gatt, at(icrgm=0) noestimcheck /* THIS ALSO WORKS */ Contrasts of predictive margins Model VCE : Robust Expression : Linear prediction, predict() at : icrgm = 0 ------------------------------------------------- | df chi2 P>chi2 --------------+---------------------------------- importer_gatt | 1 65.93 0.0000 ------------------------------------------------- --------------------------------------------------------------- | Delta-method | Contrast Std. Err. [95% Conf. Interval] --------------+------------------------------------------------ importer_gatt | (1 vs 0) | 2.092815 .2577455 1.587643 2.597986 --------------------------------------------------------------- /* BUT THIS DOES NOT WORK */ margins r.importer_gatt, at(icrgm=(0 6)) noestimcheck conformability error r(503); In other words, I am getting a message for Conformability error when I try to compare the adjusted means for different values of icrgm. The above does not work without the r. contrast operator as well. The weird part is that any combination of the above code has worked before for me (even this morning)! The .do file also consists of the following codes before (the problem appears) that run alright. anova lnimport1 honest_imp##importer_gatt; /* honest_imp is a (0/1) categorical variable*/ margins importer_gatt#honest_imp; marginsplot, noci; contrast importer_gatt@honest_imp, pveffects nowald; contrast importer_gatt#honest_imp, pveffects nowald; Any help is greatly appreciated. Sincerely, Suryadipta Roy. * * 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/