FrandsenTest: Perform test of Frandsen (2019).

View source: R/FrandsenTest.R

FrandsenTestR Documentation

Perform test of Frandsen (2019).

Description

This function computes the test of Frandsen (2019). It is based on subsampling and has very much unoptimized implementation, so can be rahter slow.

Usage

FrandsenTest(
  data,
  Y.name,
  C.name,
  X.name = NULL,
  ssreps = 500,
  TRIM_POINT = 0.75
)

Arguments

data

Data frame.

Y.name

Name of the variable in data that represents the observed time min(T, C).

C.name

Name of the variable in data that represents the censoring times.

X.name

Name of the discrete variable in data that represents the single discrete covariate allowed in the testing procedure.

ssreps

Number of subsampling repetitions to perform.

TRIM_POINT

Quantile of C at which to trim the integral when computing the test statistic. Frandsen recommends the value 0.75, which is therefore selected as the default value.

References

Brigham R. Frandsen (2019) Testing Censoring Point Independence, Journal of Business & Economic Statistics, 37:3, 496-505, DOI: 10.1080/07350015.2017.1383261

Examples


# Generate survival data with censoring time always observed
n <- 5000
X <- sample(0:1, 10, replace = TRUE)
U <- copula::rCopula(n, copula::frankCopula(param = 6))
T <- X + qexp(U[, 1], rate = 1)
C <- X + qexp(U[, 2], rate = 1.5)
Y <- pmin(T, C)
Delta <- as.numeric(Y == T)
data <- as.data.frame(cbind(Y, Delta, C, X))
colnames(data) <- c("Y", "Delta", "C", "X")

# Run test of Frandsen
Y.name <- "Y"
C.name <- "C"
X.name <- "X"
ssreps <- 500
TRIM_POINT <- 0.75
FrandsenTest(data, Y.name, C.name, X.name, ssreps, TRIM_POINT)



depCensoring documentation built on Oct. 4, 2026, 5:07 p.m.