analyticJoint: Analytic joint measures of predictive accuracy

View source: R/analyticJoint.R

analyticJointR Documentation

Analytic joint measures of predictive accuracy

Description

Analytic calculation of joint sensitivity, specificity, positive and negative predictive value, concordance and relative utility, under a multivariate liability threshold model.

Usage

analyticJoint(VL, VX, VLX = NULL, thresh = NULL, prev, nsample = NULL)

Arguments

VL

Variance-covariance matrix of liability. Must have 1 on diagonal.

VX

Variance-covariance matrix of predictors.

VLX

Cross-covariance matrix between liabilities and predictors. Entry on row i, column j, is covariance between liability i and predictor j. Diagonal entries are the liability variances explained for each trait.

thresh

Vector of risk thresholds for predicting an event. If NULL, which is the default, concordance is the only measure that can be calculated.

prev

Vector of prevalences, ie population risks, for each trait.

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 simulating nsample such pairs of individuals from the specified model.

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

# results will vary due to random sampling in computing multivariate integrals
attach(PRSdata)
analyticJoint(VL,VX,VX,thresh=prevalence,prev=prevalence,nsample=1e5)

# $sens
# [1] 0.04205708

# $spec
# [1] 0.9958742

# $PPV
# [1] 6.884139e-09

# $NPV
# [1] 1

# $C
# [1] 0.76669

# $RU
# [1] 0.03931163


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