joint: Joint measures of predictive accuracy

View source: R/joint.R

jointR Documentation

Joint measures of predictive accuracy

Description

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

Usage

joint(x, y, thresh = NULL, prev = NULL, condprev = NULL, nsample = 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.

prev

Probability of all events occurring, required for calculating relative utility. If NULL, which is the default, then prev is estimated from the y matrix, ignoring ascertainment.

condprev

Probability of all events occuring, conditional on the risk predictions being equal to thresh. If NULL, which is the default, then prev is set to the product of the elements of thresh. This working definition is exact when predictions and outcomes both are jointly independent.

nsample

Number of random pairs of samples drawn when estimating concordance. If NULL, which is the default, concordance is not calculated. If 0, all possible pairs are drawn from the data.

Details

Joint measures consider the prediction of all outcomes occuring in an individual. For example, joint sensitivity is the probability that, given an individual in which all outcomes did occur, the predicted risk exceeds the threshold for all outcomes. Joint specificity is the probability that, given an individual in which at least one outcome did not occur, the predicted risk is lower than the threshold for at least one outcome.

Joint concordance is the probability that, given one individual in which all outcomes did occur, and another in which at least one outcome did not occur, the minimum predicted risk over all outcomes is greater in the former individual. It is calculated by randomly drawing such pairs of individuals from y. If nsample is zero, all such pairs are drawn from y; this might be time-consuming. Therefore the default is not to calculate concordance. However, a good estimate of concordance can be obtained from a limited number of random samples nsample.

prev and condprev are only required to calculate relative utility, and can be omitted otherwise.

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)
joint(risk[,1:2],disease[,1:2],thresh=prevalence[1:2],nsample=1e5)

# $sens
# [1] 0.4041096

# $spec
# [1] 0.7653745

# $PPV
# [1] 0.02488402

# $NPV
# [1] 0.9885961

# $C
# [1] 0.63282

# $RU
# [1] 0.3292956


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