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: margins: error at values for factor do not sum to 1
From
Hanna Schwander <[email protected]>
To
[email protected]
Subject
st: margins: error at values for factor do not sum to 1
Date
Mon, 25 Feb 2013 17:22:57 +0100
Hi Statalists,
I'd like to know how the marginal effect of gender changes on my dependent dummy variable over time. I run a logit model
including a full factorial interaction between gender and year_dv.
The logit model works just fine, but I receive the error "at values for factor year_dv do not sum to 1" when stata tries to calculate the
marginal effects.
It must be related to the covariate, because if I calculate ME only for logit dv i.gender##year_dv i_educ_y, it works perfectly fine.
gender is a dummy variable (0:1) and year_dv is a categorical variable with values of 1976, 1983, 1990, 1993, 1996, 1997, ..., 2011.
I would appreciate any help or explanation what's going on.
best,
Hanna
logit dv i.gender##year_dv hhcomp AGE i.unempl i.retired i.couple i.selfempl i.educ_y if cnty2==4, rob
> ust
Iteration 0: log pseudolikelihood = -9811.722
Iteration 1: log pseudolikelihood = -8447.6971
Iteration 2: log pseudolikelihood = -8427.5904
Iteration 3: log pseudolikelihood = -8427.4542
Iteration 4: log pseudolikelihood = -8427.4542
Logistic regression Number of obs = 14317
Wald chi2(32) = 2086.81
Prob > chi2 = 0.0000
Log pseudolikelihood = -8427.4542 Pseudo R2 = 0.1411
--------------------------------------------------------------------------------
| Robust
dv | Coef. Std. Err. z P>|z| [95% Conf. Interval]
---------------+----------------------------------------------------------------
1.gender | .0315729 .1357372 0.23 0.816 -.2344672 .297613
|
year_dv |
1978 | -.7536955 .1605846 -4.69 0.000 -1.068435 -.4389555
1983 | -.6530303 .1440718 -4.53 0.000 -.9354058 -.3706549
1989 | .1768951 .1319218 1.34 0.180 -.0816668 .435457
1991 | .8093866 .1381717 5.86 0.000 .538575 1.080198
1993 | .8264365 .153616 5.38 0.000 .5253547 1.127518
1998 | 2.470491 .1973473 12.52 0.000 2.083697 2.857285
2000 | 1.913222 .1414099 13.53 0.000 1.636063 2.19038
2005 | -.5515456 .1394236 -3.96 0.000 -.8248108 -.2782805
2006 | -.6318867 .1457566 -4.34 0.000 -.9175644 -.3462089
2009 | .5445553 .1391717 3.91 0.000 .2717837 .8173269
2010 | -.0664371 .1215095 -0.55 0.585 -.3045913 .171717
2011 | -1.277709 .1521589 -8.40 0.000 -1.575935 -.9794832
|
gender#year_dv |
1 1978 | .0290359 .2115727 0.14 0.891 -.385639 .4437108
1 1983 | .135529 .1932716 0.70 0.483 -.2432764 .5143344
1 1989 | -.0226443 .1814511 -0.12 0.901 -.378282 .3329934
1 1991 | -.0175356 .1901607 -0.09 0.927 -.3902438 .3551725
1 1993 | .4637764 .2166843 2.14 0.032 .039083 .8884697
1 1998 | -.3900139 .2615363 -1.49 0.136 -.9026156 .1225877
1 2000 | -.0903408 .1906076 -0.47 0.636 -.4639249 .2832433
1 2005 | .0909939 .1872374 0.49 0.627 -.2759847 .4579726
1 2006 | .1630719 .1880115 0.87 0.386 -.2054239 .5315677
1 2009 | .1353967 .1886154 0.72 0.473 -.2342827 .5050762
1 2010 | .1808376 .1629267 1.11 0.267 -.1384929 .500168
1 2011 | .1192825 .2067946 0.58 0.564 -.2860274 .5245924
|
hhcomp | .023339 .0220796 1.06 0.290 -.0199362 .0666142
AGE | -.0039472 .0014175 -2.78 0.005 -.0067255 -.001169
1.unempl | .3955106 .095885 4.12 0.000 .2075794 .5834419
1.retired | -.0081702 .0594042 -0.14 0.891 -.1246003 .1082598
1.couple | -.155951 .0432974 -3.60 0.000 -.2408123 -.0710896
1.selfempl | -.1637611 .0755383 -2.17 0.030 -.3118135 -.0157087
1.educ_y | -.105405 .0448559 -2.35 0.019 -.1933209 -.0174891
_cons | .2682743 .1204209 2.23 0.026 .0322536 .504295
--------------------------------------------------------------------------------
.
.
. margins, dydx(gender) at(year_dv=(1976 1978 1983 1989 1991 1993 1998 2000 2001 2003 2005 2006
> 2009 2010 2011)) vsquish
at values for factor year_dv do not sum to 1
r(198);
end of do-file
PS: I am using Stata/IC 12.1 for Mac (64-bit Intel)
Revision 30 Jan 2013
*
* 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/