Learn R Programming

R2ROC (version 1.0.1)

auc_diff: auc_diff function

Description

This function estimates var(AUC(y~x[,v1]) - AUC(y~x[,v2])) where AUC is the Area Under ROC curve of the model, y is N by 1 matrix having the dependent variable, and x is N by M matrix having M explanatory variables. v1 or v2 indicates the ith column in the x matrix (v1 or v2 can be multiple values between 1 - M, see Arguments below)

Usage

auc_diff(dat, v1, v2, nv, kv)

Value

This function will estimate significant difference between two PRS (either dependent or independent and joint or single). To get the test statistics for the difference between AUC(y~x[,v1]) and AUC(y~x[,v2]) (here we define AUC1=AUC(y~x[,v1])) and AUC2=AUC(y~x[,v2]))). The outputs are listed as follows.

mean_diff

AUC differences between AUC1 and AUC2

var

Variances of AUC differences

upper_diff

Upper value of the differences

lower_diff

Upper value of the differences

p

Two tailed P-value for significant difference between AUC1 and AUC2

p_one_tail

One tailed P-value for significant difference

heller_p

P-value based on Heller's test for significant difference

heller_upper_diff

Upper limit of 95% CI for the difference basedon Heller's test

heller_lower_diff

Lower limit of 95% CI for the difference basedon Heller's test

Arguments

dat

N by (M+1) matrix having variables in the order of cbind(y,x)

v1

This can be set as v1=c(1) or v1=c(1,2)

v2

This can be set as v2=c(2), v2=c(3), v2=c(1,3) or v2=c(3,4)

nv

Sample size

kv

Population prevalence

Examples

Run this code
#To get the test statistics for the difference between AUC(y=x[,1]) 
#and AUC(y=x[,2])
dat=dat1 #(this example embedded within the package)
nv=length(dat$V1)
kv=sum(dat$V1)/length(dat$V1)# pop. prevalence estimated from data
#R2ROC also allows users to estimate AUC using pre-adjusted phenotype
#In that case, users need to specify kv
#eg. kv=0.10 for dat2 (dat2 embedded within the package) 
v1=c(1)
v2=c(2)
output=auc_diff(dat,v1,v2,nv,kv)

#R2ROC output
#output$mean_diff (mean difference of AUC1 and AUC2)
#0.1756046

#output$var (variance of AUC difference)
#9.274356e-05

#output$upper_diff (upper limit of 95% CI for difference)
#0.1944801

#output$lower_diff (lower limit of 95% CI for difference)
#0.1567292

#output$p (two-tailed P-value for the differences is
#significantly different from zero)
#2.747031e-74

#output$p_one_tail (one-tailed P-value for the differences
#is significantly different from zero)
#1.373515e-74


#To get the test statistics for the difference between
#AUC(y=x[,1]+x[,2]) and AUC(y=x[,2])
dat=dat1 #(this example embedded within the package)
nv=length(dat$V1)
kv=sum(dat$V1)/length(dat$V1)# pop. prevalence estimated from data
#R2ROC also allows users to estimate AUC using pre-adjusted phenotype
#In that case, users need to specify kv
#eg. kv=0.10 for dat2 (dat2 embedded within the package) 
v1=c(1,2)
v2=c(2)
output=auc_diff(dat,v1,v2,nv,kv)

#R2ROC output
#output$mean_diff (mean difference of AUC1 and AUC2)
#0.1793682

#output$var (variance of AUC difference)
#0.0001190366

#output$upper_diff (upper limit of 95% CI for difference)
#0.2007526

#output$lower_diff (lower limit of 95% CI for difference)
#0.1579839

#output$p (two-tailed P-value for the differences is
#significantly different from zero)
#9.87014e-61

#output$p_one_tail (one-tailed P-value for the differences
#is significantly different from zero)
#4.93507e-61

#output$heller_p (two-tailed P-value based on Hellers test
#for the differences is significantly different from zero)
#4.2085e-237

#output$heller_upper_diff (upper limit of 95% CI for
#difference based on Hellers test)
#0.2013899

#output$heller_lower_diff (lower limit of 95% CI for
#difference based on Hellers test)
#0.1586212

Run the code above in your browser using DataLab