R/OverallRiskSummaries.MI.R
OverallRiskSummaries.MI.Rd
Compare estimated h function when all predictors are at a particular quantile to when all are at a second fixed quantile
OverallRiskSummaries.MI(
BKMRfits,
qs = seq(0.25, 0.75, by = 0.05),
q.fixed = 0.5,
q.alwaysfixed = NULL,
index.alwaysfixed = NULL,
sel = NULL,
method = "approx"
)
A list of multiple BKMR fits and that each of these fits were ran for the same number of MCMC iterations.
vector of quantiles at which to calculate the overall risk summary
a second quantile at which to compare the estimated h function
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
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
a data frame containing the (posterior mean) estimate and posterior standard deviation of the overall risk measures
For guided examples, go to https://zc2326.github.io/causalbkmr/articles/MI_BKMR.html
library(causalbkmr)
data("BKMRfits10")
sel.MI <- seq(5001,10000, by = 5)
overallrisks.MI <- OverallRiskSummaries.MI(BKMRfits = BKMRfits10, qs = seq(0.1, 0.9, by = 0.05), q.fixed = 0.5, sel = sel.MI, method = "approx")
#> [1] "approx method"
#> [1] "1 out of 17 complete: 0.04 min run time"
#> [1] "2 out of 17 complete: 0.04 min run time"
#> [1] "3 out of 17 complete: 0.05 min run time"
#> [1] "4 out of 17 complete: 0.05 min run time"
#> [1] "5 out of 17 complete: 0.05 min run time"
#> [1] "6 out of 17 complete: 0.06 min run time"
#> [1] "7 out of 17 complete: 0.06 min run time"
#> [1] "8 out of 17 complete: 0.06 min run time"
#> [1] "9 out of 17 complete: 0.07 min run time"
#> [1] "10 out of 17 complete: 0.07 min run time"
#> [1] "11 out of 17 complete: 0.07 min run time"
#> [1] "12 out of 17 complete: 0.08 min run time"
#> [1] "13 out of 17 complete: 0.08 min run time"
#> [1] "14 out of 17 complete: 0.08 min run time"
#> [1] "15 out of 17 complete: 0.08 min run time"
#> [1] "16 out of 17 complete: 0.09 min run time"
#> [1] "17 out of 17 complete: 0.09 min run time"
ggplot(overallrisks.MI, aes(quantile, est, ymin = est - 1.96 * sd, ymax = est + 1.96 * sd)) +
geom_hline(yintercept = 00, linetype = "dashed", color = "gray") +
geom_pointrange()+ ggtitle("") + scale_y_continuous(name="estimate")
#> Error in ggplot(overallrisks.MI, aes(quantile, est, ymin = est - 1.96 * sd, ymax = est + 1.96 * sd)): could not find function "ggplot"