withPV.survey.design | R Documentation |
Repeats an analysis for each of a set of 'plausible values' in a survey data set, returning a list suitable for mitools::MIcombine
. The default method works for both standard and replicate-weight designs but not for two-phase designs.
## S3 method for class 'survey.design'
withPV(mapping, data, action, rewrite=TRUE, ...)
mapping |
A formula or list of formulas describing each variable in the analysis that has plausible values. The left-hand side of the formula is the name to use in the analysis; the right-hand side gives the names in the dataset. |
data |
A survey design object, as created by |
action |
With |
rewrite |
Rewrite |
... |
For methods |
A list of the results returned by each evaluation of action
, with the call as an attribute.
with.svyimputationList
if(require(mitools)){
data(pisamaths, package="mitools")
des<-svydesign(id=~SCHOOLID+STIDSTD, strata=~STRATUM, nest=TRUE,
weights=~W_FSCHWT+condwt, data=pisamaths)
oo<-options(survey.lonely.psu="remove")
results<-withPV(list(maths~PV1MATH+PV2MATH+PV3MATH+PV4MATH+PV5MATH),
data=des,
action=quote(svyglm(maths~ST04Q01*(PCGIRLS+SMRATIO)+MATHEFF+OPENPS, design=des)),
rewrite=TRUE)
summary(MIcombine(results))
options(oo)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.