Learn R Programming

Overview

predtools provides miscellaneous tools for developing and evaluating prediction models.

Table of Contents

Installation

You can install the released version of predtools from CRAN with:

install.packages("predtools")

And the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("resplab/predtools")

Example

The function calibration_plot takes observed and predicted values from a prediction model and uses ggplot2 to produce a calibration plot:

library(predtools)
library(dplyr)
x <- rnorm(100, 10, 2)
y <- x + rnorm(100,0, 1)
data <- tibble(x,y)
calibration_plot(data, obs = "x", pred_1 = "y")

See vignettes for more advanced functionalities, including model-based ROC, intercept adjustment, calibration plot, and unit normal loss integral in two dimensions.

You can also access the vignettes from R:

browseVignettes("predtools")

Copy Link

Version

Install

install.packages('predtools')

Monthly Downloads

398

Version

0.0.3

License

GPL

Issues

Pull Requests

Stars

Forks

Maintainer

Amin Adibi

Last Published

June 5th, 2023

Functions in predtools (0.0.3)

mAUC

Takes in a mROC object and calculates the area under the curve
mROC_inference

Statistical inference for comparing empirical and expected ROCs. If CI=TRUE then also returns pointwise CIs
mROC_analysis

Main eROC analysis that plots ROC and eROC
gusto

Anonymized data from the gusto trial
calc_mROC_stats

Calculates the absolute surface between the empirical and expected ROCs
calc_NB_moments

Calculates the first two moments of the bivariate distribution of NB_model and NB_all
mROC

Calculates mROC from the vector of predicted risks Takes in a vector of probabilities and returns mROC values (True positives, False Positives in an object of class mROC)
evpi_val

EVPI (Expected Value of Perfect Information) for validation Takes a vector of mean and a 2X2 covariance matrix
calibration_plot

Title Create calibration plot based on observed and predicted outcomes.
pred_summary_stat

Title Estimate mean and variance of prediction based on model calibration output.
mu_max_trunc_bvn

Calculates the expected value of the maximum of two random variables with zero-truncated bivariate normal distribution Takes a vector of mean and a 2X2 covariance matrix
odds_adjust

Title Update a prediction model for a binary outcome by multiplying a fixed odd-ratio to the predicted odds.
dev_data

model development data
val_data

model validation data