summary_functions: Functions to summarize, visualize, and analyze data

fmt_risk_tableR Documentation

Functions to summarize, visualize, and analyze data

Description

Functions to summarize, visualize, and analyze data

Usage

fmt_risk_table(
  dir,
  slug = c("sl_pkrate", "sl_pkweek", "sl_cumhosp"),
  altslug = NULL
)

get_risk_dist(outcome = c("pkrate", "pkweek", "cumhosp"))

get_learner_weights(
  dir,
  slug = c("sl_pkrate", "sl_pkweek", "sl_cumhosp"),
  metalearner_is = c("nnls", "solnp")
)

join_learner_stats(risktables, weights)

summarize_learner_selection(learner_stats)

relabel_rf(data)

apply_rf_relabel(data)

plot_risktiles(data, titlestring = "", font = "serif")

plot_ensemble_performance(data, risktables, titlestring = "", font = "serif")

Arguments

dir

Directory where desired super learner results are stored.

slug

Slug that identifies the prediction target. One of 'sl_pkrate', 'sl_pkweek', or 'sl_cumhosp'.

altslug

Additional label to identify sensitivity analyses.

outcome

Prediction target outcome. One of 'pkrate', 'pkweek', or 'cumhosp'

risktables

A list object containing risk tables, generated by fmt_risk_table.

weights

A list object containing weight tables, generated by get_learner_weights

learner_stats

The data.table produced by 'join_learner_stats'.

data

A _rwsum type data set.

titlestring

Add a title to the plot.

font

Control font in plot output. Defaults to "serif".

Value

The function explicitly returns the risk table described in the function's description. In the process of executing, the function also assigns a list containing data.tables containing mean learner risks for each week of the flu season.

A list of length 30, corresponding to the number of weeks of the flu sesaon, containing data.tables storing the mean risks for all learners.

Returns a data.table containing all learners and , their mean risks, and the weights assigned to them.

Returns a data.table containing the number and percentage of weeks during which each learner is assigned a non-zero weight by the metalearner.

Functions

  • fmt_risk_table(): Formats risk tables that compare average risks of the ensemble super learner, discrete super learner, and mean prediction.

  • get_risk_dist(): Outputs a summary of the distribution of cross-validated risks across all learners, by week of the flu season.

  • get_learner_weights(): Pulls the weights assigned to each learner by the metalearner.xm

  • join_learner_stats(): Generates a data.table that links each learner's mean cross-validated risk and the weight assigned to that learner based on the metalearner fit, for each week of the flu season.

  • summarize_learner_selection(): Calculates the number of weeks during which a learner was assigned non-zero weight.

  • relabel_rf(): Helper function for cleaning random forest learner names

  • apply_rf_relabel(): Helper function to format results for plotting.

  • plot_risktiles(): Produces a tile plot summarizing component risks and metalearner weights.

  • plot_ensemble_performance(): Produces a plot of the ensemble super learner's mean risk across all 30 weeks of the flu season against the mean prediction reference, as well as the distribution of cross-validated risks and ensemble weights assigned to each component learner.


jrgant/FluHospPrediction documentation built on May 7, 2023, 10:40 a.m.