Statalist


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

Re: st: predictive margins not estimable in svy


From   kmacdonald@stata.com (Kristin MacDonald, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: predictive margins not estimable in svy
Date   Tue, 11 Aug 2009 16:04:27 -0500

Sue <susan@hailpern.com> ran the following commands in Stata

    . svy, subpop(subpopnodm): logistic pad i.x age56 sex01 race2 
    . margins i.x , subpop(if subpopnodm==1)

and -margins- reported that none of the margins for x were estimable.  We
asked for Sue's data privately and discovered a bug in Stata that will be
fixed in the upcoming executable update.

In the mean time, Sue can use the -noestimcheck- option to prevent -margins-
from performing its estimability check.  We know this is safe because Sue
isn't changing the dataset between the calls to -svy: logistic- and -margins-
and Sue's model does not contain any interaction terms.

However, if you are fitting a model with interactions where you are likely to
have a real problem with estimability, we recommend you wait for the update so
that you will only obtain results that are truely estimable.

The rest of this email contains some details about how Stata checks for
estimable margins and what caused -margins- to not report the estimable
margins for Sue.

First we'll note that to trigger the problem, you'll need to have missing
values for covariates in observations that were outside the subpopulation.

As described in the 'Estimable functions' section of the 'Methods and
formulas' in -[R] margins-, -margins- uses the following rule to check for
estimable functions:

	A linear combination of regression coefficients 'zb' is estimable when
	z = zH, where H = GX'X and G is a generalized inverse of X'X.

H is generated when the fitted coefficients are posted to -e()-, and in Sue's
case H contained missing values because out-of-subpopulation observations with
missing values were incorrectly being used to genereate X'X and thus H.

-----

In a second email, Sue also reported that she obtained the following error
message when trying to specify the -vce(unconditional)- option with -margins-:

    . margins x, vce(unconditional) 
    unconditional standard errors derived assuming full estimation sample;
    indepvars dropped observations from the estimation sample
    r(459);

The above command requests that margins be computed using the values of the
independent variables from the full sample.  This is not possible for the
given situation because the estimation sample contains missing values in some
of the indpendent variables.

After the next ado-file update, Sue will be able to use the -subpop()- option
to get the unconditional standard errors for her subpopulation margins.

    . margins x, vce(unconditional) subpop(subpopnodm)

--Kristin MacDonald			--Jeff Pitblado
  kmacdonald@stata.com			  jpitblado@stata.com
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index