plotCV: Plotting Functions used in Cross Validation Analysis...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

The function plotPrediction plots cross validation predictions of a phenotype against true values of the phenotype with multiple summary stats in the title.

The function plotCVcors plots the predictive power (correlations) across predictions using various numbers of markers.

The function plotROC plots an ROC (Receiver operating characteristic) curve for predictions of a binary outcome.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plotPrediction(
        param,
        outcome,
        forecast,
        cpgs2use,
        main,
        dfFull = NULL)
        
plotCVcors(cl, param)

plotROC(outcome, forecast)

Arguments

param

List of parameters as described in the "RW6_param.Rmd" vignette.
Try: vignette("RW6_param","ramwas").
Only modeloutcome, cvnfolds and mmalpha elements are used.

outcome

Values of a phenotype. Must be binary for plotROC.

forecast

Predictions for the phenotype.

cpgs2use

Number of variables used for prediction (for the legend).

main

Part of the title (summary stats are added beneath).

dfFull

Number of degrees of freedom for the significance testing.
Default is: length(forecast) - 2

cl

List with three elements:

  • x - vector with the number of variables used for prediction

  • corp - Pearson correlations between the predictions and the true value of the phenotype.

  • cors - Spearman correlations between the predictions and the true value of the phenotype.

Details

The plotROC and plot has no title.
To add a title use title.

Value

The plotROC returns the area under the curve (AUC) for the ROC.
The plotPrediction function returns the list of calculated statistics printed in the title.
The plotCVcors returns nothing (NULL).

Author(s)

Andrey A Shabalin andrey.shabalin@gmail.com

See Also

See vignettes: browseVignettes("ramwas").

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Sample data
n = 300
param = list(modeloutcome = "Age", mmalpha = 0, cvnfolds = 5)
outcome = rnorm(n, mean = 50, sd = 20)
forecast = outcome + rnorm(n, mean = 0, sd = 20)
cpgs2use = 1000
main = "Prediction success (simulated data)"

# Plot phenotype-prediction plot
plotPrediction(
        param,
        outcome,
        forecast,
        cpgs2use,
        main)

# Artificial data for plotCVcors()
cl = list(
    x =    c(50,  100, 200, 500,  1000),
    corp = c(0.1, 0.6, 0.7, 0.85, 0.8),
    cors = c(0.1, 0.6, 0.7, 0.85, 0.8) + rnorm(5)*0.1)

# Plot prediction performance by the number of markers    
plotCVcors(cl, param)  

# Make the outcome binary for ROC plot
outcome = (outcome > 50)

# Plot ROC curve and calculate the AUC
plotROC(outcome, forecast)

ramwas documentation built on Nov. 8, 2020, 8:24 p.m.