| with.svyimputationList {survey} | R Documentation |
Performs a survey analysis on each of the designs in a
svyimputationList objects and returns a list of results suitable
for MIcombine. The analysis may be specified as an expression or
as a function.
## S3 method for class 'svyimputationList':
with(data, expr, fun, ...,multicore=getOption("survey.multicore"))
## S3 method for class 'svyimputationList':
subset(x, subset,...,all=FALSE)
data,x |
A svyimputationList object |
expr |
An expression giving a survey analysis |
fun |
A function taking a survey design object as its argument |
... |
for future expansion |
multicore |
Use multicore package to distribute imputed data sets over multiple processors? |
subset |
An logical expression specifying the subset |
all |
If TRUE the subset is those where the expression is TRUE
for all imputations, otherwise it is those where the expression is TRUE for
any imputation. |
A list of the results from applying the analysis to each design object.
MIcombine, in the mitools package
library(mitools)
data.dir<-system.file("dta",package="mitools")
files.men<-list.files(data.dir,pattern="m.\\.dta$",full=TRUE)
men<-imputationList(lapply(files.men, foreign::read.dta))
files.women<-list.files(data.dir,pattern="f.\\.dta$",full=TRUE)
women<-imputationList(lapply(files.women, foreign::read.dta))
men<-update(men, sex=1)
women<-update(women,sex=0)
all<-rbind(men,women)
designs<-svydesign(id=~id, strata=~sex, data=all)
designs
results<-with(designs, svymean(~drkfre))
MIcombine(results)
summary(MIcombine(results))