### Comparison of emergence distributions
## of tooth 44 on boys and girls
data("tandmob", package="icensBKL")
## take only first 50 children here
## to decrease the CPU time
## of the example
tandmob50 <- tandmob[1:50,]
## only needed variables
Acompare <- subset(tandmob50, select=c("fGENDER", "L44", "R44"))
## left-censored observations:
## change lower limit denoted by NA to 0
Acompare$L44[is.na(Acompare$L44)] <- 0
## right-censored observations:
## change upper limit denoted by NA to 20
## 20 = infinity in this case
Acompare$R44[is.na(Acompare$R44)] <- 20
## inputs for kSampleIcens function
Amat <- Acompare[, c("L44", "R44")]
Group <- Acompare$fGENDER
## two-sample test
## (interval-censored version of classical Mantel's log-rank)
kSampleIcens(A=Amat, group=Group, rho=0, gamma=0)
## some other choices of rho and gamma,
## pooled CDF is supplied to kSampleIcens function
## to speed-up the calculation
## and also to set maxiter to higher value than above
## to ensure convergence
poolcdf <- PGM(A=Amat, maxiter=10000)
## IC version of classical Mantel's log-rank again
kSampleIcens(A=Amat, group=Group, icsurv=poolcdf, rho=0, gamma=0)
## IC version of Peto-Prentice generalization of
## the Wilcoxon test
kSampleIcens(A=Amat, group=Group, icsurv=poolcdf, rho=1, gamma=0)
kSampleIcens(A=Amat, group=Group, icsurv=poolcdf, rho=0, gamma=1)
kSampleIcens(A=Amat, group=Group, icsurv=poolcdf, rho=1, gamma=1)
Run the code above in your browser using DataLab