compute_performance: Computes performance measures for prognostic scores on a set...

Description Usage Arguments Details Value Methods (by generic) Examples

View source: R/compute_performance.R

Description

Computes performance measures for prognostic scores on a set of bootstrap samples

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
compute_performance(bs.sample, fn = calibration_slope, lbl = NULL)

## S3 method for class 'mscraw'
print(x, ...)

## S3 method for class 'mscraw'
summary(object, nonpar = TRUE, NArm = TRUE, ...)

## S3 method for class 'mscraw'
points(x, ...)

## S3 method for class 'mscraw'
lines(x, ...)

Arguments

bs.sample

A set of cohort-stratified bootstrap samples, as generated with get_bs_samples

fn

The name of a function to compute performance measures. For example, calibration_slope. See details.

lbl

A label to describe the performance measure computed. For example "calibration slope". This label is used in subsequent plot functions, and appears in tables of regression coefficients of. Useful if you want to compute several performance measures, or the same performance measure on different subsets of data.

x

Set of performance estimates calculated with compute_performance

...

Other arguments to be passed to print. Ignored by summary, points and lines.

object

Set of performance estimates calculated with compute_performance

nonpar

Should nonparametric summary statistics (median [IQR]) be reported? (TRUE)

NArm

Should NAs be removed before calculated summary statistics? (TRUE)

Details

The function to compute performance measures, fn requires two arguments:

bss

The name of the bootstrap sample. The full bootstrap data is called within the function as analysis(bss). See bootstraps for more details.

fn

The formula that will be called by the model, of the form outcome ~ score (character).

and outputs a single numeric value. A value of NA is assigned if there is an error.

Value

A list with 3 elements, of class msc_raw:

working.estimates

A tibble containing a set of "working estimates", the raw performance measures, before they have been aggregated or contrasts have been computed.

scores

Names of the scores as given in get_bs_samples

formulas

vector of formulas)

fn

The function definition used to compute performance

lbl

The label given in the arguments.

The results of compute_performance have suitable print and summary methods.

Methods (by generic)

Examples

1
2
3
4
5
6
7
8
9
dat <- msc_sample_data()
bssamp <- get_bs_samples(dat, id, study, outcome, n.samples = 5, 
                  scores = c("a", "b", "c"), 
                  moderators = "age")
perf <- compute_performance(bssamp, fn = calibration_slope, lbl = "CS")
print(perf)
summary(perf)
points(perf)
lines(perf)

srhaile/mscpredmodel documentation built on Sept. 13, 2019, 3:44 p.m.