Z
from a single level (quantile) to a second level (quantile), for the other variables in Z
fixed to a specific level (quantile) for MI BKMR fitsR/SingVarRiskSummaries.MI.R
SingVarRiskSummaries.MI.Rd
Single Variable Risk Summaries for MI BKMR fits
Compute summaries of the risks associated with a change in a single variable in Z
from a single level (quantile) to a second level (quantile), for the other variables in Z
fixed to a specific level (quantile) for MI BKMR fits
A list of multiple BKMR fits and that each of these fits were ran for the same number of MCMC iterations.
vector indicating which variables (columns of Z) for which the summary should be computed
vector indicating the two quantiles q_1 and q_2 at which to compute h(z_{q2}) -h(z_{q1})
vector of quantiles at which to fix the remaining predictors in Z
the quantile values in the point which we want to keep fixed for all comparisons
the index values in the point which we want to keep fixed for all comparisons
selects which iterations of the MCMC sampler to use for inference
column names of the selected columns of Z in which.z
method for obtaining posterior summaries at a vector of new points. Options are"approx" and "exact"; defaults to "approx", which is faster particularly for large datasets
other arguments to pass on to the prediction function
a data frame containing the (posterior mean) estimate and posterior standard deviation of the predictor risk measures
For guided examples, go to https://zc2326.github.io/causalbkmr/articles/MI_BKMR.html
if (FALSE) {
library(causalbkmr)
data(BKMRfits10)
singvarrisk.MI.fixed <- SingVarRiskSummaries.MI(BKMRfits = BKMRfits10, which.z=c(1,3,4),
qs.diff = c(0.25, 0.75), q.fixed = c(0.25, 0.50, 0.75),
q.alwaysfixed = 0.25, index.alwaysfixed = 2,
sel=sel.MI, method = "approx")
## plot the single variable dataframe for the MI fits
ggplot(singvarrisk.MI, aes(variable, est, ymin = est - 1.96*sd,
ymax = est + 1.96*sd, col = q.fixed)) +
geom_hline(aes(yintercept=0), linetype="dashed", color="gray") +
geom_pointrange(position = position_dodge(width = 0.75)) +
coord_flip() + ggtitle("")+
scale_x_discrete(name="Variable")+ scale_y_continuous(name="estimate")
}