Description Usage Arguments Value Examples
View source: R/get_bs_samples.R
Generates bootstrap samples
1 2 | get_bs_samples(data, id, cohort, outcome, n.samples = 1000,
scores = NULL, moderators = NULL)
|
data |
Dataset containing subject identifiers, names of cohorts, outcome, and each of the scores |
id |
name of variable with subject identifiers |
cohort |
name of variable containing cohorts (the stratification factor, can be a factor, character or numeric) |
outcome |
name of outcome variable (binomial) |
n.samples |
Number of bootstrap samples to be generated within each cohort (default 1000) |
scores |
A vector of variable names that are scores (or their predicted probabilities). The order the scores are here is used in all other functions. |
moderators |
A vector of variable names that are moderators, that is, covariates which could affect the differences in score performance. We save these variables here, to be aggregated later in |
A list with 3 elements:
A data.frame containing the stratified bootstrap samples, split by cohort
A data.frame containing the orignal data, split by cohort
Unique names of the scores which are also in the dataset
A vector of moderators which may be included in subsequent models
vector of formulas that can be used in any function which calculates performance measures (e.g. calibration_slope
)
1 2 3 | dat <- msc_sample_data()
set.seed(12345)
get_bs_samples(dat, id, study, outcome, scores = letters[1:3], moderators = "age")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.