Learn R Programming

riskPredictClustData (version 0.2.6)

riskPredictDiff: Difference of two risk prediction rules for clustered data

Description

Difference of two risk prediction rules for clustered data.

Usage

riskPredictDiff(frame, alpha = 0.05)

Arguments

frame

A data frame with 5 columns: cid, subuid, status, score1, and score2. cid indicates cluster id; subuid indicates unit ID within a cluster; status=1 indicates an eye is progressed; status=0 indicates an eye is not progressed; score1 represents the score based on prediction rule 1. score2 represents the score based on prediction rule 2.

alpha

numeric. The confidence level.

Value

A list of 7 elements:

diff

the difference of test statistics \(\hat{\eta}_c^{(1)}-\hat{\eta}_c^{(2)}\) hateta_c^(1)-hateta_c^(2) based on the 2 prediction rules.

se.diff

standard error of the difference under the null hypothesis.

z

z score z=diff/se.diff

pval

p-value of the test

res1

output object of the function riskPredict for prediction rule 1.

res2

output object of the function riskPredict for prediction rule 2.

rhoVec

A vector of 4 correlations: \(\rho=cov(H_{ij}^{(1)}, H_{ij}^{(2)})\), \(\rho_{11}=cov(H_{ij}^{(1)}, H_{it}^{(1)})\), \(\rho_{22}=cov(H_{ij}^{(2)}, H_{it}^{(2)})\), and \(\rho_{12}=cov(H_{ij}^{(1)}, H_{it}^{(2)})\)

E.diff.Ha

expectation of the difference under the alternative hypothesis.

se.diff.Ha

standard error of the difference under the alternative hypothesis.

CIlow.diff

Lower confidence limit.

CIup.diff

Upper confidence limit.

References

Rosner B, Qiu W, and Lee MLT. Assessing Discrimination of Risk Prediction Rules in a Clustered Data Setting. Lifetime Data Anal. 2013 Apr; 19(2): 242-256.

Examples

Run this code
# NOT RUN {


set.seed(1234567)
datFrame = genSimDataGLMEM(nSubj = 30, beta0 = -6, sd.beta0i = 1.58, 
                          beta1 = 1.58, beta2 = -3.95, beta3 = 3.15, beta4 = 2.06,
                          beta5 = 0.51, beta6 = 1.47, beta7 = 3.11, 
                          p.smkcur = 0.08, p.inieye31 = 0.44, p.inieye32 = 0.42,
                          p.inieye41 = 0.12, p.inieye42 = 0.11, sd.lncalorc = 0.33)

print(dim(datFrame))
print(datFrame[1:2,])

# prediction rule 1
tt1 = getScore(fmla = prog~smkcur+lncalorc+inieye3+inieye4+factor(rtotfat), 
  cidVar = "cid", subuidVar = "subuid", statusVar = "prog", 
  datFrame = datFrame, mycorstr = "exchangeable",
  verbose = FALSE)
myframe1=tt1$frame

print(dim(myframe1))
print(myframe1[1:3,])

####
# prediction rule 2
tt2 = getScore(fmla = prog~smkcur+lncalorc+inieye3+inieye4, 
  cidVar = "cid", subuidVar = "subuid", statusVar = "prog", 
  datFrame = datFrame, mycorstr = "exchangeable",
  verbose = FALSE)
myframe2=tt2$frame

print(dim(myframe2))
print(myframe2[1:3,])

# combine scores from two prediction rules
myframe12=myframe1[, c("cid", "subuid", "status")]
myframe12$score1=myframe1$score
myframe12$score2=myframe2$score
print(dim(myframe12))
print(myframe12[1:3,])

####
resDiff = riskPredictDiff(frame=myframe12)
print(names(resDiff))
print(resDiff)



# }

Run the code above in your browser using DataLab