mecor: mecor: a Measurement Error Correction Package

Description Usage Arguments Value Author(s) References Examples

View source: R/mecor.R

Description

mecor provides correction methods for measurement error in a continuous covariate or outcome in linear regression models with a continuous outcome

Usage

1
mecor(formula, data, method = "standard", B = 0)

Arguments

formula

an object of class formula (or one that is coerced to that class): a symbolic description of the regression model containing a MeasError, MeasErrorExt or MeasErrorRandom object in one of the covariates or the outcome.

data

a data.frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model specified in formula.

method

a character string indicating the method used to correct for the measurement error, either "standard" (regression calibration for covariate measurement error and method of moments for outcome measurement error), "efficient" (efficient regression calibration for covariate measurement error and efficient method of moments for outcome measurement error), "valregcal" (validation regression calibration) or "mle" (maximum likelihood estimation). Defaults to "standard".

B

number of bootstrap samples, defaults to 0.

Value

mecor returns an object of class "mecor".

An object of class mecor is a list containing the following components:

corfit

a list containing the corrected fit, including the coefficients of the corrected fit (coef) and the variance–covariance matrix of the coefficients of the corrected fit obtained by the delta method (vcov), and more depending on the method used.

uncorfit

an lm.fit object of the uncorrected fit.

Author(s)

Linda Nab, l.nab@lumc.nl

References

L. Nab, R.H.H. Groenwold, P.M.J. Welsing, and M. van Smeden. Measurement error in continuous endpoints in randomised trials: problems and solutions

L. Nab, M. van Smeden, R.H. Keogh, and R.H.H. Groenwold. mecor: an R package for measurement error correction in linear models with continuous outcomes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## measurement error in a covariate/outcome:
# internal covariate-validation study
data(vat)
out <-
mecor(ir_ln ~ MeasError(wc, reference = vat) + sex + age + tbf,
      data = vat,
      method = "standard",
      B = 999)
# replicates study
data(bloodpressure)
mecor(creatinine ~ MeasError(sbp30, replicate = cbind(sbp60, sbp120)) + age,
      data = bloodpressure,
      method = "mle")
# outcome-calibration study
data(sodium)
mecor(MeasError(recall, replicate = cbind(urinary1, urinary2)) ~ diet,
      data = sodium,
      method = "efficient")
# external outcome-validation study
data(haemoglobin_ext)
calmod_fit <- lm(capillary ~ venous, data = haemoglobin_ext)
data(haemoglobin) # suppose reference venous is not available
mecor(MeasErrorExt(capillary, model = calmod_fit) ~ supplement,
      data = haemoglobin)
# sensitivity analyses
data(vat) # suppose reference vat is not available
# guesstimate the coefficients of the calibration model:
mecor(ir_ln ~ MeasErrorExt(wc, model = list(coef = c(0.2, 0.5, -1.3, 0, 0.6))) + sex + age + tbf,
      data = vat)
# assume random measurement error in wc of magnitude 0.25:
mecor(ir_ln ~ MeasErrorRandom(wc, variance = 0.25) + sex + age + tbf,
      data = vat)
data(bloodpressure) # suppose replicates sbp60 and sbp60 are not available
mecor(creatinine ~ MeasErrorRandom(sbp30, variance = 25) + age,
      data = bloodpressure)

## differential measurement error in the outcome:
# internal outcome-validation study
mecor(MeasError(capillary, reference = venous, differential = supplement) ~ supplement,
      data = haemoglobin,
      method = "standard")

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