adjust_sel {multibias} | R Documentation |
adjust_sel
returns the exposure-outcome odds ratio and confidence
interval, adjusted for selection bias.
adjust_sel(
data_observed,
data_validation = NULL,
s_model_coefs = NULL,
level = 0.95
)
data_observed |
Object of class |
data_validation |
Object of class |
s_model_coefs |
The regression coefficients corresponding to the model: logit(P(S=1)) = β0 + β1X + β2Y, where S represents binary selection, X is the exposure, and Y is the outcome. The number of parameters is therefore 3. |
level |
Value from 0-1 representing the full range of the confidence interval. Default is 0.95. |
Bias adjustment can be performed by inputting either a validation dataset or
the necessary bias parameters. 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.
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).
df_observed <- data_observed(
data = df_sel,
exposure = "X",
outcome = "Y",
confounders = "C1"
)
# Using validation data -----------------------------------------------------
df_validation <- data_validation(
data = df_sel_source,
true_exposure = "X",
true_outcome = "Y",
confounders = "C1",
selection = "S"
)
adjust_sel(
data_observed = df_observed,
data_validation = df_validation
)
# Using s_model_coefs -------------------------------------------------------
adjust_sel(
data_observed = df_observed,
s_model_coefs = c(0, 0.9, 0.9)
)