#To get the test statistics for the difference between R(y~x[,1]) and
#R(y~x[,2]). (here we define R_1=R(y~x[,1])) and R_2=R(y~x[,2])))
dat=dat1
nv=length(dat$V1)
v1=c(1)
v2=c(2)
output=r_diff(dat,v1,v2,nv)
output
#r2redux output
#output$r1 (R_1)
#0.1958636
#output$r2 (R_2)
#0.197006
#output$var1 (variance of R_1)
#0.0009247466
#output$var2 (variance of R_1)
#0.0001451358
#output$var_diff (variance of difference between R_1 and R_2)
#3.65286e-06
#output$r_based_p (two tailed p-value for significant difference between R_1 and R_2)
#0.5500319
#output$r_based_p_one_tail (one tailed p-value
#0.2750159
#output$mean_diff
#-0.001142375 (differences between R2_1 and R2_2)
#output$upper_diff (upper limit of 95% CI for the difference)
#0.002603666
#output$lower_diff (lower limit of 95% CI for the difference)
#-0.004888417
#To get the test statistics for the difference between R(y~x[,1]+[,2]) and
#R(y~x[,2]). (here R_1=R(y~x[,1]+x[,2]) and R_2=R(y~x[,1]))
nv=length(dat$V1)
v1=c(1,2)
v2=c(2)
output=r_diff(dat,v1,v2,nv)
output
#output$r1
#0.1974001
#output$r2
#0.197006
#output$var1
#0.0009235848
#output$var2
#0.0009238836
#output$var_diff
#3.837451e-06
#output$r2_based_p
#0.8405593
#output$mean_diff
#0.0003940961
#output$upper_diff
#0.004233621
#output$lower_diff
#-0.003445429
#Note: If the directions are not consistent, for instance, if one correlation
#is positive (R_1) and another is negative (R_2), or vice versa, it is
#crucial to approach the interpretation of the comparative test with caution.
#This caution is especially emphasized when applying r_diff()
#in a nested model comparison involving a joint model
Run the code above in your browser using DataLab