ipwm {mecor} | R Documentation |
Weighting for Confounding and Joint Misclassification of Exposure and Outcome
Description
ipwm
implements a method for estimating the marginal causal odds ratio by constructing weights (modified inverse probability weights) that address both confounding and joint misclassification of exposure and outcome.
Usage
ipwm(
formulas,
data,
outcome_true,
outcome_mis = NULL,
exposure_true,
exposure_mis = NULL,
nboot = 1000,
conf_level = 0.95,
fix_nNAs = FALSE,
semiparametric = FALSE,
optim_args = list(method = "BFGS"),
force_optim = FALSE,
sp = Inf,
print = TRUE
)
Arguments
formulas |
a list of objects of class |
data |
|
outcome_true |
a character string specifying the name of the true outcome variable that is free of misclassification but possibly unknown ( |
outcome_mis |
a character string specifying the name of the counterpart of |
exposure_true |
a character string specifying the name of the true exposure variable that is free of misclassification but possibly unknown ( |
exposure_mis |
a character string specifying the name of the counterpart of |
nboot |
number of bootstrap samples. Setting |
conf_level |
the desired confidence level of the confidence interval |
fix_nNAs |
logical indicator specifying whether or not to fix the joint distribution of |
semiparametric |
logical indicator specifying whether or not to parametrically sample |
optim_args |
arguments passed onto |
force_optim |
logical indicator specifying whether or not to force the |
sp |
scalar shrinkage parameter in the interval |
print |
logical indicator specifying whether or not to print the output. |
Details
This function is an implementation of the weighting method described by Penning de Vries et al. (2018). The method defaults to the estimator proposed by Gravel and Platt (2018) in the absence of exposure misclassification.
The function assumes that the exposure or the outcome has a misclassified version. An error is issued when both outcome_mis
and exposure_mis
are set to NULL
.
Provided force_optim = FALSE
, ipwm
is considerably more efficient when the optim
function is not invoked; i.e., when (1) exposure_mis = NULL
and the formula for outcome_true
does not contain stats::terms involving outcome_mis
or exposure_true
, (2) outcome_mis = NULL
and the formula for exposure_true
does not contain stats::terms involving exposure_mis
or outcome_true
, or (3) all(is.na(data[, exposure_true]) == is.na(data[, outcome_true]))
and the formulas for exposure_true
and outcome_true
do not contain stats::terms involving exposure_mis
or outcome_mis
. In these cases, ipwm
uses iteratively reweighted least squares via the glm
function for maximum likelihood estimation. In all other cases, optim_args
is passed on to optim
for optimisation of the joint likelihood of outcome_true
, outcome_mis
, exposure_true
and exposure_mis
.
Value
ipwm
returns an object of class ipwm
.
The returned object is a list containing the following elements:
logOR |
the estimated log odds ratio; |
call |
the matched function call. |
If nboot != 0
, the list also contains
SE |
a bootstrap estimate of the standard error for the estimator of the log odds ratio; |
CI |
a bootstrap percentile confidence interval for the log odds ratio. |
Author(s)
Bas B. L. Penning de Vries, b.b.l.penning_de_vries@lumc.nl
References
Gravel, C. A., & Platt, R. W. (2018). Weighted estimation for confounded binary outcomes subject to misclassification. Statistics in medicine, 37(3), 425-436. https://doi.org/10.1002/sim.7522
Penning de Vries, B. B. L., van Smeden, M., & Groenwold, R. H. H. (2020). A weighting method for simultaneous adjustment for confounding and joint exposure-outcome misclassifications. Statistical Methods in Medical Research, 0(0), 1-15. https://doi.org/10.1177/0962280220960172
Examples
data(sim) # simulated data on 10 covariates, exposure A and outcome Y.
formulas <- list(
Y ~ A + L1 + L2 + L3 + L4 + L5 + L6 + L7 + L8 + L9 + L10 + B + Z,
A ~ L1 + L2 + L3 + L4 + L5 + L6 + L7 + L8 + L9 + L10 + B + Z,
Z ~ L1 + L2 + L3 + L4 + L5 + L6 + L7 + L8 + L9 + L10 + B,
B ~ L1 + L2 + L3 + L4 + L5 + L6 + L7 + L8 + L9 + L10
)
## Not run:
ipwm_out <- ipwm(
formulas = formulas,
data = sim,
outcome_true = "Y",
outcome_mis = "Z",
exposure_true = "A",
exposure_mis = "B",
nboot = 200,
sp = 1e6
)
ipwm_out
## End(Not run)