View source: R/analyticPanelWise.R
analyticPanelWise | R Documentation |
Analytic calculation of panel-wise sensitivity, specificity, positive and negative predictive value, concordance and relative utility, under a multivariate liability threshold model.
analyticPanelWise(VL, VX, VLX = NULL, thresh = NULL, prev, nsample = NULL)
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. |
Panel-wise measures consider the prediction of at least one outcome to occur. At least one outcome that did occur must be predicted to occur. For example, panel-wise sensitivity is the probability that, for an individual in which at least one outcome did occur, the predicted risk exceeds the threshold for at least one of the outcomes that did occur. Panel-wise specificity is the probability that, for an individual in which at least one outcome did not occur, the predicted risk is lower than the threshold for all the outcomes that did not occur.
Panel-wise concordance is the probability that given one individual in which at least one outcome did occur, and another in which at least one did not occur,
the maximum predicted risk over all outcomes that occurred in the former is higher than the maximum over all outcomes that did not occur in the latter.
Note that under this definition an individual can be either concordant or discordant with itself.
Concordance is calculated by randomly simulating nsample
such pairs of individuals from the specified model.
A list with the following components
sens
Sensitivity
spec
Specificity
PPV
Positive predictive value
NPV
Negative predictive value
C
Concordance
RU
Relative utility
# results will vary due to random sampling in computing multivariate integrals attach(PRSdata) analyticPanelWise(VL,VX,VX,thresh=prevalence,prev=prevalence,nsample=1e5) # $sens # [1] 0.6463497 # $spec # [1] 0.0708455 # $PPV # [1] 0.1081343 # $NPV # [1] 0.9371735 # $C # [1] 0.49142 # $RU # [1] -0.31006
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.