| outcomeWise | R Documentation |
Calculates outcome-wise sensitivity, specificity, positive and negative predictive value, concordance and relative utility for a vector of predictors.
outcomeWise(x, y, thresh = NULL, weight = NULL, prev = NULL)
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. |
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.
A list with the following components
sens Sensitivity
spec Specificity
PPV Positive predictive value
NPV Negative predictive value
C Concordance
RU Relative utility
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.