permDep: Permutation test for general dependent truncation

Description Usage Arguments Value References Examples

View source: R/depTrun.R

Description

Perform permutation test based on conditional or unconditional approach.

Usage

1
2
3
4
permDep(trun, obs, permSize, cens, sampling = c("conditional",
  "unconditional", "is.conditional", "is.unconditional"), kendallOnly = FALSE,
  minp1Only = FALSE, minp2Only = FALSE, nc = ceiling(detectCores()/2),
  seed = NULL)

Arguments

trun

is the left truncation time.

obs

is the observed failure time.

permSize

is the number of permutations.

cens

is the status indicator; 0 = censored, 1 = event.

sampling

a character string specifying the sampling method used in permutation. The following are permitted:

conditional

conditional permutation;

uconditional

unconditional permutation;

is.conditional

importance sampling version of conditional permutation;

is.uconditional

importance sampling version of unconditional permutation;

kendallOnly, minp1Only, minp2Only

optional values indicating which test statistics to be used. If all leave as FALSE, permDep will use all three test statistics in each permutation.

nc

is the number of cores used in permutation. When nc > 1, permutation is carried out with parallel computing.

seed

an optional vector containing random seeds to be used to generate permutation samples. Random seeds will be used when left unspecified.

Value

A list containing output with the following components:

obsKen

the observed p-value using Kendall's tau test statistic.

obsP1

the observed p-value using minp1 test statistic.

obsP2

the observed p-value using minp2 test statistic.

obsTest1

the observed minp1 test statistic.

obsTest2

the observed minp2 test statistic.

permKen

Kendall's tau test statistics from permutation samples.

permP1

minp1 test statistics from permutation samples.

permP2

minp2 test statistics from permutation samples.

References

Chiou, S.H., Qian, J., and Betensky, R.A. (2017). Permutation Test for General Dependent Truncation. Tech-report

Examples

 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

Example output

   user  system elapsed 
  2.728   0.021   2.803 

permDep documentation built on May 2, 2019, 4:56 a.m.