knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This is a basic example which shows you a typical analysis for a dataset having individual patient data for 30 cohorts, each with some combination of scores a, b, c, e, and g. The example here has only 25 bootstrap samples to speed up the runtime, but an actual analysis should use more.
library(mscpredmodel) library(ggplot2) theme_set(theme_bw()) dat <- msc_sample_data() head(dat) M <- 25 bs.example <- get_bs_samples(data = dat, id = id, cohort = study, outcome = outcome, n.samples = M, scores = c("a", "b", "c", "e", "g"), moderators = c("age", "female"))
We want to examine performance of the 5 scores according to calibration-in-the-large. We show a basic analysis for calibration-in-the-large, and then repeat the analysis with calibration slope. Note that we use the same set of bootstrap samples for each of the performance measures, so that any differences in variability are due only to the performance measures themselves, and not because of differing bootstrap samples.
ps <- compute_performance(bs.example, fn = calibration_large, lbl = "calibration-in-the-large") summary(ps) msc_model(ps, mtype = "consistency") msc_model(ps, mtype = "inconsistency") check_transitivity(ps, graph = TRUE) check_homogeneity(msc_model(ps, mtype = "inconsistency")) allpairs <- msc_network(ps) plot(allpairs)
ps2 <- compute_performance(bs.example, fn = calibration_slope, lbl = "calibration slope") lines(ps2) msc_model(ps2, mtype = "consistency") msc_model(ps2, mtype = "inconsistency") check_transitivity(ps2, graph = TRUE) check_homogeneity(msc_model(ps2, mtype = "inconsistency")) allpairs2 <- msc_network(ps2, ref = "e") plot(allpairs2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.