| predict.rake {rake} | R Documentation |
Use predict on a "rake" class object to obtain adjusted sample values
that reflect the sample weights in rake.
This is the third function in the rake, rakeadj,
predict.rake Rake analysis series.
predict.rake(object,
col = stop("Prediction column (argument 'col') must be specified."),
forcefactor = FALSE,
data = eval(parse(text=dataname(rake)),parent.frame(1)),
... )
object |
object of class "rake" created with the function rake. |
col |
column of data from which re-weighted data will be
gathered and returned. |
forcefactor |
logical: should data[,col] be treated as a
factor, even if it is numeric data? |
data |
usually the data.frame from which the rake was generated. |
... |
other arguments to pass to default methods. |
List with entries:
data |
the original data of interest. |
weight |
the adjusted weights from the rake, formatted as a
vector that corresponds to a column of data. |
data.est |
the data of interest after re-weighting. |
Simply use predict(rake) rather than predict.rake(rake).
Toby Dylan Hocking <tdhock@ocf.berkeley.edu>
Sharon L. Lohr. Sampling: Design and Analysis, pp. 269-271. Brooks/Cole, Pacific Grove, CA, 1999.
rake for creating the initial "rake" class object,
rakeadj for performing the rake adjustment,
simpleRake for performing the entire Raking process.
example(rakeadj)
for( i in 1:5 ) {
cat("Variable:",names(certify)[i],"\n")
rakeresult <- predict(r,i,forcefactor=TRUE)
data <- rakeresult$data
pred <- rakeresult$data.est
print(rbind(data,pred))
cat("\n")
}