Adust for uncontrolled confounding and exposure misclassification.
Source:R/adjust_uc_em.R
adjust_uc_em.Rd
adjust_uc_em
returns the exposure-outcome odds ratio and confidence
interval, adjusted for uncontrolled confounding and exposure
misclassificaiton.
Usage
adjust_uc_em(
data_observed,
data_validation = NULL,
u_model_coefs = NULL,
x_model_coefs = NULL,
x1u0_model_coefs = NULL,
x0u1_model_coefs = NULL,
x1u1_model_coefs = NULL,
level = 0.95
)
Arguments
- data_observed
Object of class
data_observed
corresponding to the data to perform bias analysis on.- data_validation
Object of class
data_validation
corresponding to the validation data used to adjust for bias in the observed data. Here, the validation data should have data for the same variables as in the observed data, plus data for the true and misclassified exposure corresponding to the observed exposure indata_observed
. There should also be data for the confounder missing indata_observed
.- u_model_coefs
The regression coefficients corresponding to the model: logit(P(U=1)) = α0 + α1X + α2Y, where U is the binary unmeasured confounder, X is the binary true exposure, and Y is the outcome. The number of parameters therefore equals 3.
- x_model_coefs
The regression coefficients corresponding to the model: logit(P(X=1)) = δ0 + δ1X* + δ2Y + δ2+jCj, where X represents the binary true exposure, X* is the binary misclassified exposure, Y is the outcome, and C represents the vector of measured confounders (if any), and j corresponds to the number of measured confounders. The number of parameters therefore equals 3 + j.
- x1u0_model_coefs
The regression coefficients corresponding to the model: log(P(X=1,U=0)/P(X=0,U=0)) = γ1,0 + γ1,1X* + γ1,2Y + γ1,2+jCj, where X is the binary true exposure, U is the binary unmeasured confounder, X* is the binary misclassified exposure, Y is the outcome, C represents the vector of measured confounders (if any), and j corresponds to the number of measured confounders.
- x0u1_model_coefs
The regression coefficients corresponding to the model: log(P(X=0,U=1)/P(X=0,U=0)) = γ2,0 + γ2,1X* + γ2,2Y + γ2,2+jCj, where X is the binary true exposure, U is the binary unmeasured confounder, X* is the binary misclassified exposure, Y is the outcome, C represents the vector of measured confounders (if any), and j corresponds to the number of measured confounders.
- x1u1_model_coefs
The regression coefficients corresponding to the model: log(P(X=1,U=1)/P(X=0,U=0)) = γ3,0 + γ3,1X* + γ3,2Y + γ3,2+jCj, where X is the binary true exposure, U is the binary unmeasured confounder, X* is the binary misclassified exposure, Y is the outcome, C represents the vector of measured confounders (if any), and j corresponds to the number of measured confounders.
- level
Value from 0-1 representing the full range of the confidence interval. Default is 0.95.
Value
A list where the first item is the odds ratio estimate of the effect of the exposure on the outcome and the second item is the confidence interval as the vector: (lower bound, upper bound).
Details
Bias adjustment can be performed by inputting either a validation dataset or
the necessary bias parameters. Two different options for the bias parameters
are available here: 1) parameters from separate models of U and X
(u_model_coefs
and x_model_coefs
) or 2) parameters from a
joint model of U and X (x1u0_model_coefs
,
x0u1_model_coefs
, and x1u1_model_coefs
).
Values for the bias parameters can be applied as
fixed values or as single draws from a probability
distribution (ex: rnorm(1, mean = 2, sd = 1)
). The latter has
the advantage of allowing the researcher to capture the uncertainty
in the bias parameter estimates. To incorporate this uncertainty in the
estimate and confidence interval, this function should be run in loop across
bootstrap samples of the dataframe for analysis. The estimate and
confidence interval would then be obtained from the median and quantiles
of the distribution of odds ratio estimates.
Examples
df_observed <- data_observed(
data = df_uc_em,
exposure = "Xstar",
outcome = "Y",
confounders = "C1"
)
# Using validation data -----------------------------------------------------
df_validation <- data_validation(
data = df_uc_em_source,
true_exposure = "X",
true_outcome = "Y",
confounders = c("C1", "U"),
misclassified_exposure = "Xstar",
)
adjust_uc_em(
data_observed = df_observed,
data_validation = df_validation
)
#> $estimate
#> [1] 2.128296
#>
#> $ci
#> [1] 2.048492 2.211209
#>
# Using u_model_coefs and x_model_coefs -------------------------------------
adjust_uc_em(
data_observed = df_observed,
u_model_coefs = c(-0.23, 0.63, 0.66),
x_model_coefs = c(-2.47, 1.62, 0.73, 0.32)
)
#> $estimate
#> [1] 2.020545
#>
#> $ci
#> [1] 1.939266 2.105231
#>
# Using x1u0_model_coefs, x0u1_model_coefs, x1u1_model_coefs ----------------
adjust_uc_em(
data_observed = df_observed,
x1u0_model_coefs = c(-2.82, 1.62, 0.68, -0.06),
x0u1_model_coefs = c(-0.20, 0.00, 0.68, -0.05),
x1u1_model_coefs = c(-2.36, 1.62, 1.29, 0.27)
)
#> $estimate
#> [1] 2.04704
#>
#> $ci
#> [1] 1.963578 2.134050
#>