MeasErrorExt {mecor} | R Documentation |
Create an External Measurement Error Object
Description
This function creates an external measurement error object, usually used as
a covariate or the outcome in the formula
argument of
mecor if one wants to correct for the measurement error in that
variable using external data or externally estimated coefficients of the
calibration model (covariate-measurement error) or measurement error model
(outcome-measurement error)
Usage
MeasErrorExt(substitute, model)
Arguments
substitute |
a vector containing the error-prone measure |
model |
a fitted linear model of class lm or a named
list. The list contains a vector named |
Value
MeasErrorExt
returns an object of class
"MeasErrorExt".
An object of class MeasErrorExt
is a list containing the substitute
variable and the fitted calibration model or measurement error model and has
attributes input (the name of the substitute variable) and call (the matched
call).
Author(s)
Linda Nab, l.nab@lumc.nl
Examples
## measurement error in a outcome:
# external outcome-validation study
data(haemoglobin_ext)
# calibration model
calmod_fit <- lm(capillary ~ venous, data = haemoglobin)
# the external covariate-validation study can be used to correct for the
# measurement error in X_star in the dataset 'icvs', using the fitted
# calibration model
data(haemoglobin)
with (haemoglobin, MeasErrorExt(substitute = capillary,
model = calmod_fit))
# identical to:
calmod_coef <- coefficients(calmod_fit)
calmod_vcov <- vcov(calmod_fit)
with (haemoglobin, MeasErrorExt(substitute = capillary,
model = list(coef = calmod_coef,
vcov = calmod_vcov)))
# when no external data is available, guesstimations of the coefficients of
# the calibration model can be used instead:
with (haemoglobin, MeasErrorExt(substitute = capillary,
model = list(coef = c('(Intercept)' = -7,
'venous' = 1.1))))