MeasErrorExt: Create an External Measurement Error Object

Description Usage Arguments Value Author(s) Examples

View source: R/MeasErrorExt.R

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

1

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 coef: the coefficients of the calibration model or measurement error model and an optional matrix named vcov: the variance–covariance matrix of the coefficients

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## 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))))

LindaNab/mecor documentation built on Dec. 15, 2021, 6:59 p.m.