1\name{withPV.survey.design} 2\alias{withPV.survey.design} 3%- Also NEED an '\alias' for EACH other topic documented here. 4\title{ 5Analyse plausible values in surveys 6} 7\description{ 8Repeats an analysis for each of a set of 'plausible values' in a survey data set, returning a list suitable for \code{mitools::MIcombine}. The default method works for both standard and replicate-weight designs but not for two-phase designs. 9} 10\usage{ 11\S3method{withPV}{survey.design}(mapping, data, action, rewrite=TRUE, ...) 12} 13%- maybe also 'usage' for other objects documented here. 14\arguments{ 15 \item{mapping}{ 16A 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. 17} 18 \item{data}{ 19A survey design object, as created by \code{svydesign} or \code{svrepdesign} 20} 21 \item{action}{ 22With \code{rewrite=TRUE}, a function taking a survey design object as 23its only argument, or a quoted expression. With \code{rewrite=TRUE} 24a function taking a survey design object as its only argument, or a 25quoted expression with \code{.DESIGN} referring to the survey design object to be used. 26} 27\item{rewrite}{ 28Rewrite \code{action} before evaluating it (versus constructing new data 29sets) 30 } 31 \item{\dots}{ 32For methods 33} 34} 35\value{ 36A list of the results returned by each evaluation of \code{action}, with the call as an attribute. 37} 38 39 40\seealso{ 41\code{\link{with.svyimputationList}} 42} 43\examples{ 44if(require(mitools)){ 45data(pisamaths, package="mitools") 46des<-svydesign(id=~SCHOOLID+STIDSTD, strata=~STRATUM, nest=TRUE, 47 weights=~W_FSCHWT+condwt, data=pisamaths) 48 49oo<-options(survey.lonely.psu="remove") 50 51results<-withPV(list(maths~PV1MATH+PV2MATH+PV3MATH+PV4MATH+PV5MATH), 52 data=des, 53 action=quote(svyglm(maths~ST04Q01*(PCGIRLS+SMRATIO)+MATHEFF+OPENPS, design=des)), 54 rewrite=TRUE) 55 56summary(MIcombine(results)) 57options(oo) 58} 59} 60% Add one or more standard keywords, see file 'KEYWORDS' in the 61% R documentation directory. 62\keyword{survey}% use one of RShowDoc("KEYWORDS")