# NOT RUN {
## 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")
# }
Run the code above in your browser using DataLab