cvamPredict: Predict Missing or Coarsened Values from a Fitted Model

cvamPredictR Documentation

Predict Missing or Coarsened Values from a Fitted Model

Description

After fitting a log-linear model with cvam, the fitted model object may be passed to this function, along with a dataset containing missing or coarsened values, to predict one or more variables from their predictive distribution given the observed data and parameters from the fitted model.

Usage

cvamPredict(form, obj, data, freq, meanSeries = TRUE, sep = ".")

Arguments

form

a one-sided formula indicating the variable or variables to be predicted, with variables separated by '+'

obj

an object produced by cvam containing results from a model fit

data

data frame for prediction, possibly different from the data used to fit the model contained in obj

freq

variable containing frequencies for data. If omitted, all frequencies are taken to be 1, meaning that the prediction frame is assumed to contain microdata.

meanSeries

applies when obj contains results from a simulation run. If TRUE, then the requested predictions are based on a running mean of cell probabilities over all iterations after the burn-in period. If FALSE, then the requested predictions are based only on the cell probabilities from the final iteration, and (assuming the run was sufficiently long, if MCMC) can be regarded as a single draw from their posterior distribution.

sep

character sting used to separate the levels of multiple variables being predicted

Details

Predictions from this function are unlike predictions from a regression model. In regression, prediction is to compute the estimated mean response ar specific values of the predictors. With this function, predictions are based on the predictive distribution for one or more variables given all the observed data, including the variable(s) to be predicted if they are seen. The prediction for a variable that is seen will assign a probability of one to the seen value and zero probability to other values.

Value

A data frame containing the predicted probabilities or frequencies, with an attribute colFrame that identifies its columns

Author(s)

Joe Schafer Joseph.L.Schafer@census.gov

References

For more information, refer to the package vignette Log-Linear Modeling with Missing and Coarsened Values Using the cvam Package.

See Also

cvam, cvamEstimate, cvamImpute, cvamLik

Examples

fit <- cvam( ~ V1 + V2, freq=n, data=crime )
cvamPredict( ~ V1, fit, data=crime, freq=n )   # predict frequencies
cvamPredict( ~ V1, fit, data=crime  )          # predict probabilities

cvam documentation built on March 7, 2023, 5:29 p.m.