moPrep {Amelia}R Documentation

Prepare Multiple Overimputation Settings

Description

A function to generate priors for multiple overimputation of a variable measured with error.

Usage

moPrep(
  x,
  formula,
  subset,
  error.proportion,
  gold.standard = !missing(subset),
  error.sd
)

## S3 method for class 'molist'
moPrep(x, formula, subset, error.proportion, gold.standard = FALSE, error.sd)

## Default S3 method:
moPrep(
  x,
  formula,
  subset,
  error.proportion,
  gold.standard = !missing(subset),
  error.sd
)

Arguments

x

either a matrix, data.frame, or a object of class "molist" from a previous moPrep call. The first two derive the priors from the data given, and the third will derive the priors from the first moPrep call and add them to the already defined priors.

formula

a formula describing the nature of the measurement error for the variable. See "Details."

subset

an optional vector specifying a subset of observations which possess measurement error.

error.proportion

an optional vector specifying the fraction of the observed variance that is due to measurement error.

gold.standard

a logical value indicating if values with no measurement error should be used to estimate the measurement error variance.

error.sd

an optional vector specifying the standard error of the measurement error.

Details

This function generates priors for multiple overimputation of data measured with error. With the formula arugment, you can specify which variable has the error, what the mean of the latent data is, and if there are any other proxy measures of the mismeasured variable. The general syntax for the formula is: errvar ~ mean | proxy, where errvar is the mismeasured variable, mean is a formula for the mean of the latent variable (usually just errvar itself), and proxy is a another mismeasurement of the same latent variable. The proxies are used to estimate the variance of the measurement error.

subset and gold.standard refer to the the rows of the data which are and are not measured with error. Gold-standard rows are used to estimate the variance of the measurement. error. error.proportion is used to estimate the variance of the measurement error by estimating the variance of the mismeasurement and taking the proportion assumed to be due to error. error.sd sets the standard error of the measurement error directly.

Value

An instance of the S3 class "molist" with the following objects:

Note that priors and overimp might contain results from multiple calls to moPrep, not just the most recent.

Methods (by class)

See Also

amelia

Examples

 data(africa)
 m.out <- moPrep(africa, trade ~ trade, error.proportion = 0.1)
 a.out <- amelia(m.out, ts = "year", cs = "country")
 plot(a.out)
 m.out <- moPrep(africa, trade ~ trade, error.sd = 1)
 a.out <- amelia(m.out, ts = "year", cs = "country")


[Package Amelia version 1.8.1 Index]