estweights {survey} | R Documentation |
Creates or adjusts a two-phase survey design object using a logistic regression model for second-phase sampling probability. This function should be particularly useful in reweighting to account for missing data.
estWeights(data,formula,...) ## S3 method for class 'twophase': estWeights(data,formula,...) ## S3 method for class 'data.frame': estWeights(data,formula, subset=NULL, strata=NULL,...)
data |
twophase design object or data frame |
formula |
Predictors for estimating weights |
subset |
Subset of data frame with complete data (ie phase 1).
If NULL use all complete cases |
strata |
Stratification (if any) of phase 2 sampling |
... |
for future expansion |
If data
is a data frame, estWeights
first creates a
two-phase design object. The strata
argument is used only to
compute finite population corrections, the same variables must be
included in formula
to compute stratified sampling probabilities.
With a two-phase design object, estWeights
estimates the sampling
probabilities using logistic regression as described by Robins et al
(1994) and adds information to the object to enable correct sandwich
standard errors to be computed.
The effect on a two-phase design object is very similar to
calibrate
, and is identical when formula
specifies a saturated model.
A two-phase survey design object.
Robins JM, Rotnitzky A, Zhao LP. (1994) Estimation of regression coefficients when some regressors are not always observed. Journal of the American Statistical Association, 89, 846-866.
postStratify
,
calibrate
, twophase
data(airquality) ## ignoring missingness, using model-based standard error summary(lm(log(Ozone)~Temp+Wind, data=airquality)) ## Without covariates to predict missingness we get ## same point estimates, but different (sandwich) standard errors daq<-estWeights(airquality, formula=~1,subset=~I(!is.na(Ozone))) summary(svyglm(log(Ozone)~Temp+Wind,design=daq)) ## Reweighting based on weather, month d2aq<-estWeights(airquality, formula=~Temp+Wind+Month, subset=~I(!is.na(Ozone))) summary(svyglm(log(Ozone)~Temp+Wind,design=d2aq))