R/PredictorResponseBivar.MI.R
PredictorResponseBivar.MI.Rd
Predict the exposure-response function at a new grid of points for MI BKMR
PredictorResponseBivar.MI(
BKMRfits,
z.pairs = NULL,
method = "approx",
ngrid = 50,
q.fixed = 0.5,
sel = NULL,
min.plot.dist = 0.5,
center = TRUE,
z.names = colnames(BKMRfits[[1]]$Z),
verbose = TRUE,
...
)
A list of multiple BKMR fits and that each of these fits were ran for the same number of MCMC iterations.
data frame showing which pairs of predictors to plot
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
number of grid points in each dimension
vector of quantiles at which to fix the remaining predictors in Z
logical expression indicating samples to keep; defaults to keeping the second half of all samples
specifies a minimum distance that a new grid point needs to be from an observed data point in order to compute the prediction; points further than this will not be computed
flag for whether to scale the exposure-response function to have mean zero
optional vector of names for the columns of z
TRUE or FALSE: flag of whether to print intermediate output to the screen
other arguments to pass on to the prediction function
a long data frame with the name of the first predictor, the name of the second predictor, the value of the first predictor, the value of the second predictor, the posterior mean estimate, and the posterior standard deviation of the estimated exposure response function
For guided examples, go to https://zc2326.github.io/causalbkmr/articles/MI_BKMR.html
if (FALSE) {
library(causalbkmr)
data(BKMRfits10)
bivar.MI <- PredictorResponseBivar.MI(BKMRfits = BKMRfits10,
min.plot.dist = 1, sel=seq(5001,10000,by=500),
method="approx")
Z.MI <- Z.complete.MI(BKMRfits10)
bivar.levels.MI <- PredictorResponseBivarLevels(pred.resp.df = bivar.MI,
Z=Z.MI, both_pairs = TRUE,
qs = c(0.25, 0.5, 0.75))
ggplot(bivar.levels.MI, aes(z1, est)) + geom_smooth(aes(col = quantile), stat = "identity") +
facet_grid(variable2 ~ variable1) + ggtitle("h(expos1 | quantiles of expos2)") + xlab("expos1")
}