outcomeWise: Outcome-wise measures of predictive accuracy

View source: R/outcomeWise.R

outcomeWiseR Documentation

Outcome-wise measures of predictive accuracy

Description

Calculates outcome-wise sensitivity, specificity, positive and negative predictive value, concordance and relative utility for a vector of predictors.

Usage

outcomeWise(x, y, thresh = NULL, weight = NULL, prev = NULL)

Arguments

x

Matrix of predicted risks. Each row corresponds to an individual, each column to an outcome. Each entry should be a risk between 0 and 1.

y

Matrix of outcomes. Each row corresponds to an individual, each column to an outcome. Must contain binary outcomes coded as 0 and 1.

thresh

Vector of risk thresholds. For each row of x, each outcome is predicted to occur for which the risk exceeds the corresponding element of thresh. These predictions are then compared to the elements of y. If NULL, which is the default, concordance is the only measure that can be calculated.

weight

Vector of weights. Defaults to a vector of 1's.

prev

Vector of prevalences, ie population risks, for each trait. Defaults to NULL, in which case prevalences are estimated in the data, ignoring ascertainment.

Details

Outcome-wise measures consider the prediction of individual outcomes summed over individuals. When weight is a vector of 1's (default), outcome-wise measures correspond to classical univariate measures with the x matrix vectorised into a column vector. More generally, weight allows different outcomes to contribute more or less to the calculations.

Outcome-wise sensitivity, specificity and concordance are weighted sums of the univariate measures, where the weights depend on prev. By default, prev is estimated from the outcome rates in y, but external estimates of population risk may be used instead.

Value

A list with the following components

sens Sensitivity

spec Specificity

PPV Positive predictive value

NPV Negative predictive value

C Concordance

RU Relative utility

Examples


attach(PRSdata)
outcomeWise(risk,disease,thresh=prevalence)

# $sens
# [1] 0.6017748

# $spec
# [1] 0.6129354

# $PPV
# [1] 0.04595316

# $NPV
# [1] 0.9802688

# $C
# [1] 0.6442582

# $RU
# [1] 0.2251043


DudbridgeLab/multipred documentation built on Sept. 30, 2022, 2:24 a.m.