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 |
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:
priors a four-column matrix of the multiple overimputation priors associated with the data. Each row of the matrix is
c(row,column, prior.mean, prior.sd)
overimp a two-column matrix of cells to be overimputed. Each row of the matrix is of the form
c(row, column)
, which indicate the row and column of the cell to be overimputed.data the object name of the matrix or data.frame to which priors refer.
Note that priors
and overimp
might contain results from
multiple calls to moPrep
, not just the most recent.
Methods (by class)
-
moPrep(molist)
: Alter existing moPrep output -
moPrep(default)
: Default call to moPrep
See Also
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")