predict.rake {rake}R Documentation

Predict sample values after Rake adjustment re-weighting

Description

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.

Usage

predict.rake(object,
           col = stop("Prediction column (argument 'col') must be specified."),
           forcefactor = FALSE,
           data = eval(parse(text=dataname(rake)),parent.frame(1)),
           ... )

Arguments

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.

Value

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.

Note

Simply use predict(rake) rather than predict.rake(rake).

Author(s)

Toby Dylan Hocking <tdhock@ocf.berkeley.edu>

References

Sharon L. Lohr. Sampling: Design and Analysis, pp. 269-271. Brooks/Cole, Pacific Grove, CA, 1999.

See Also

rake for creating the initial "rake" class object, rakeadj for performing the rake adjustment, simpleRake for performing the entire Raking process.

Examples

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")
}

[Package rake version 1.0 Index]