Description Usage Arguments Value References Examples
Perform permutation test based on conditional or unconditional approach.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
trun |
is the left truncation time. |
obs |
is the observed failure time. |
permSize |
is the number of permutations. |
cens |
is the status indicator if the observed failure time are subjected to right-censoring; 0 = censored, 1 = event. |
sampling |
a character string specifying the sampling method used in permutation. The following are permitted:
|
kendallOnly, minp1Only, minp2Only |
optional values indicating which test statistics to be used.
If all leave as |
nc |
is the number of cores used in permutation.
When |
seed |
an optional vector containing random seeds to be used to generate permutation samples. Random seeds will be used when left unspecified. |
minp.eps |
an optional value indicating the width of the intervals used in minp2 procedure. The following input are allowed:
|
plot.int |
an optional logical value indicating whether an animated scatterplot will be produced to how the minp intervals are chosen for the observed data. |
anim_name |
an optional character string specifying the file name that the animation to be saved.
When not specified, file name based on the current system date and time will be used.
This argument will only be executed when |
A list containing output with the following components:
the observed p-value using Kendall's tau test statistic.
the observed p-value using minp1 test statistic.
the observed p-value using minp2 test statistic.
the observed minp1 test statistic.
the observed minp2 test statistic.
Kendall's tau test statistics from permutation samples.
minp1 test statistics from permutation samples.
minp2 test statistics from permutation samples.
Chiou, S.H., Qian, J., and Betensky, R.A. (2018). Permutation Test for General Dependent Truncation. Computational Statistics \& Data Analysis, 128, p308–324.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | simDat <- function(n) {
k <- s <- 1
tt <- xx <- yy <- cc <- delta <- rep(-1, n)
while(k <= n){
tt[k] <- runif(1, 0, 3.5)
xx[k] <- 1.95 + 0.65 * (tt[k] - 1.25)^2 + rnorm(1, sd = 0.1)
cc[k] <- runif(1, 0, 10)
delta[k] <- (xx[k] <= cc[k])
yy[k] <- pmin(xx[k], cc[k])
s <- s + 1
if(tt[k] <= yy[k]) k = k+1
}
data.frame(list(trun = tt, obs = yy, delta = delta))
}
set.seed(123)
dat <- simDat(50)
B <- 20
## Perform conditional permutation with Kendall's tau, minp1 and minp2
set.seed(123)
system.time(fit <- with(dat, permDep(trun, obs, B, delta, nc = 1)))
fit
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.