Learn R Programming

riskPredictClustData (version 0.2.6)

powerCalData: Calculate the power for testing \(\delta=0\) based on a dataset

Description

Calculate the power for testing \(\delta=0\) based on a dataset.

Usage

powerCalData(
  nSubj, 
  triangle, 
  frame,
  alpha = 0.05)

Arguments

nSubj

integer. number of subjects to be generated. Assume each subject has two observations.

triangle

the difference of the expected value the the extended Mann-Whitney U statistics between two prediction rules, i.e., \(\triangle = \eta^{(1)}_c - \eta^{(2)}_c\)

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

type I error rate

Value

A list with 11 elements.

power

the esstimated power

rho

\(\rho=corr\left(H\left(Z_{ij}\right), H\left(Z_{k\ell}\right)\right)\), where \(H=\Phi^{-1}\) is the probit transformation.

rho11

\(\rho_{11}=corr\left(H_{ij}^{(1)}, H_{i\ell}^{(1)}\right)\), where \(H=\Phi^{-1}\) is the probit transformation.

rho22

\(\rho_{22}=corr\left(H_{ij}^{(2)}, H_{i\ell}^{(2)}\right)\), where \(H=\Phi^{-1}\) is the probit transformation.

rho12

\(\rho_{12}=corr\left(H_{ij}^{(1)}, H_{i\ell}^{(2)}\right)\), where \(H=\Phi^{-1}\) is the probit transformation.

p11

\(p_{11}=Pr(\delta_{i1}=1 \& \delta_{i2}=1)\), where \(\delta_{ij}=1\) if the \(j\)-th subunit of the \(i\)-th cluster has progressed.

p10

\(p_{10}=Pr(\delta_{i1}=1 \& \delta_{i2}=0)\), where \(\delta_{ij}=1\) if the \(j\)-th subunit of the \(i\)-th cluster has progressed.

p01

\(p_{01}=Pr(\delta_{i1}=0 \& \delta_{i2}=1)\), where \(\delta_{ij}=1\) if the \(j\)-th subunit of the \(i\)-th cluster has progressed.

p00

\(p_{00}=Pr(\delta_{i1}=0 \& \delta_{i2}=0)\), where \(\delta_{ij}=1\) if the \(j\)-th subunit of the \(i\)-th cluster has progressed.

mu1

\(\mu_1=H(Y)-H(Y_c)\) is the difference between probit transformation \(H(Y)\) and probit-shift alternative \(H(Y_c)\) for the first prediction score, where \(Y\) is the prediction score of a randomly selected progressing subunit, and \(Y_c\) is the counterfactual random variable obtained if each subunit that had progressed actually had not progressed.

mu2

\(\mu_2=H(Y)-H(Y_c)\) is the difference between probit transformation \(H(Y)\) and probit-shift alternative \(H(Y_c)\) for the second prediction score, where \(Y\) is the prediction score of a randomly selected progressing subunit, and \(Y_c\) is the counterfactual random variable obtained if each subunit that had progressed actually had not progressed.

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,])


res = powerCalData(nSubj = 30, triangle = 0.05, frame=myframe12, alpha = 0.05)

print(res)


# }

Run the code above in your browser using DataLab