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

SingVarRiskSummaries.MI(
  BKMRfits,
  which.z = 1:ncol(BKMRfits[[1]]$Z),
  qs.diff = c(0.25, 0.75),
  q.fixed = c(0.25, 0.5, 0.75),
  q.alwaysfixed = NULL,
  index.alwaysfixed = NULL,
  sel = NULL,
  z.names = colnames(BKMRfits[[1]]$Z),
  method = "approx",
  ...
)

Arguments

BKMRfits

A list of multiple BKMR fits and that each of these fits were ran for the same number of MCMC iterations.

which.z

vector indicating which variables (columns of Z) for which the summary should be computed

qs.diff

vector indicating the two quantiles q_1 and q_2 at which to compute h(z_{q2}) -h(z_{q1})

q.fixed

vector of quantiles at which to fix the remaining predictors in Z

q.alwaysfixed

the quantile values in the point which we want to keep fixed for all comparisons

index.alwaysfixed

the index values in the point which we want to keep fixed for all comparisons

sel

selects which iterations of the MCMC sampler to use for inference

z.names

column names of the selected columns of Z in which.z

method

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

Value

a data frame containing the (posterior mean) estimate and posterior standard deviation of the predictor risk measures

Details

For guided examples, go to https://zc2326.github.io/causalbkmr/articles/MI_BKMR.html

Examples

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")
}