Package 'controlTest'

Title: Quantile Comparison for Two-Sample Right-Censored Survival Data
Description: Nonparametric two-sample procedure for comparing survival quantiles.
Authors: Eric S. Kawaguchi [aut, cre]
Maintainer: Eric S. Kawaguchi <[email protected]>
License: GPL-3
Version: 1.1.0
Built: 2024-11-10 04:59:36 UTC
Source: https://github.com/erickawaguchi/controltest

Help Index


Find standard error for survival quantile

Description

Find standard error for survival quantile

Usage

quantileControlTest(timevar1, censor1, timevar2, censor2, q = 0.5, B = 1000,
  seed = 1234, plots = FALSE)

Arguments

timevar1

Vector of observed survival times for sample 1 (control).

censor1

Vector of censoring indicators for sample 1 (1 = uncensored, 0 = censored).

timevar2

Vector of observed survival times for sample 2 (treatment).

censor2

Vector of censoring indicators for sample 2 (1 = uncensored, 0 = censored).

q

Quantile of interest (in terms of CDF). Default is median.

B

Number of bootstrap samples.

seed

Seed number (for reproducibility).

plots

Logical. TRUE to show plot of cumulative distribution functions.

Details

It is important to note the possiblilty that the estimated quantile may not be estimable in our bootstrap samples. In such cases the largest observed survival time will be considered as an estimate for the quantile.

Value

Returns quantile estimate, bootstrapped standard error, test statistic, and two-sided p-value.

References

Li, G., Tiwari, R.C., and Wells, M. (1996). "Quantile Comparison Functions in Two-Sample Problems: With Applications to Comparisons of Diagnostic Markers." Journal of the American Statistical Association, 91, 689-698.

Chakraborti, S., and Mukerjee, R. (1989), "A Confidence Interval for a Measure Associated With the Comparison of a Treatment With a Control," South African Statistical Journal, 23, 219-230.

Gastwirth, J. L., and Wang, J. L. (1988), "Control Percentile Test for Censored Data," Journal of Statistical Planning and Inference, 18, 267-276.

Examples

#Reference: Survival Analysis Techniques for Censored and Truncated Data.
#Klein and Moeschberger (1997) Springer.
#Data: Chapter 7.6 Example 7.9 (p. 211)
library(controlTest)
t1 <- c(1, 63, 105, 129, 182, 216, 250, 262, 301, 301,
       342, 354, 356, 358, 380, 383, 383, 338, 394, 408, 460, 489,
       499, 523, 524, 535, 562, 569, 675, 676, 748, 778, 786, 797,
       955, 968, 1000, 1245, 1271, 1420, 1551, 1694, 2363, 2754, 2950)
t2 <- c(17, 42, 44, 48, 60, 72, 74, 95, 103, 108, 122, 144, 167, 170,
       183, 185, 193, 195, 197, 208, 234, 235, 254, 307, 315, 401, 445,
       464, 484, 528, 542, 547, 577, 580, 795, 855, 1366, 1577, 2060,
       2412, 2486, 2796, 2802, 2934, 2988)
c1 <- c(rep(1, 43), 0, 0)
c2 <- c(rep(1, 39), rep(0, 6))
quantileControlTest(t1, c1, t2, c2, q = 0.5, B = 500)

Find standard error for survival quantile

Description

Find standard error for survival quantile

Usage

quantileSE(timevar, censor, q = 0.5, B = 1000, alpha = 0.05,
  seed = 1991, plots = FALSE)

Arguments

timevar

Vector of observed survival times.

censor

Vector of censoring indicators (1 = uncensored, 0 = censored).

q

Quantile of interest (Default is median).

B

Number of bootstrap samples.

alpha

Significance level for confidence interval of quantile.

seed

Seed number (for reproducibility).

plots

Logical. TRUE to show Kaplan-Meier plot

Value

Returns quantile estimate, bootstrapped standard error, and (1 - alpha / 2) * 100

Examples

#Reference: Survival Analysis Techniques for Censored and Truncated Data.
#Klein and Moeschberger (1997) Springer.
#Data: Chapter 7.6 Example 7.9 (p. 211)
library(controlTest)
t1 <- c(1, 63, 105, 129, 182, 216, 250, 262, 301, 301,
       342, 354, 356, 358, 380, 383, 383, 338, 394, 408, 460, 489,
       499, 523, 524, 535, 562, 569, 675, 676, 748, 778, 786, 797,
       955, 968, 1000, 1245, 1271, 1420, 1551, 1694, 2363, 2754, 2950)
c1 <- c(rep(1, 43), 0, 0)
quantileSE(timevar = t1, censor = c1, q = 0.5, B = 500)

Supremum-type test for two-sample comparison of survival quantiles.

Description

Supremum-type test for two-sample comparison of survival quantiles.

Usage

supControlTest(timevar1, censor1, timevar2, censor2, q.min = NULL,
  q.max = 0.5, gridpts = 50, B = 500, seed = 1234, plots = FALSE)

Arguments

timevar1

Vector of observed survival times for sample 1 (control).

censor1

Vector of censoring indicators for sample 1 (1 = uncensored, 0 = censored).

timevar2

Vector of observed survival times for sample 2 (treatment).

censor2

Vector of censoring indicators for sample 2 (1 = uncensored, 0 = censored).

q.min

Smallest quantile (in terms of CDF) to test. Default is the time to earliest event for sample 1.

q.max

Largest quantile (in terms of CDF) to test.

gridpts

Number of grid points between q.min and q.max to test.

B

Number of bootstrap samples.

seed

Seed number (for reproducibility).

plots

Logical. TRUE to show plot of cumulative distribution functions.

Details

It is important to note the possiblilty that the estimated quantile may not be estimable in our bootstrap samples. In such cases the largest observed survival time will be considered as an estimate for the quantile.

Value

Returns quantile estimate, bootstrapped standard error, test statistic, and two-sided p-value.

References

Li, G., Tiwari, R.C., and Wells, M. (1996). "Quantile Comparison Functions in Two-Sample Problems: With Applications to Comparisons of Diagnostic Markers." Journal of the American Statistical Association, 91, 689-698.

Chakraborti, S., and Mukerjee, R. (1989), "A Confidence Interval for a Measure Associated With the Comparison of a Treatment With a Control," South African Statistical Journal, 23, 219-230.

Gastwirth, J. L., and Wang, J. L. (1988), "Control Percentile Test for Censored Data," Journal of Statistical Planning and Inference, 18, 267-276.

Examples

#Reference: Survival Analysis Techniques for Censored and Truncated Data.
#Klein and Moeschberger (1997) Springer.
#Data: Chapter 7.6 Example 7.9 (p. 211)
library(controlTest)
t1 <- c(1, 63, 105, 129, 182, 216, 250, 262, 301, 301,
       342, 354, 356, 358, 380, 383, 383, 338, 394, 408, 460, 489,
       499, 523, 524, 535, 562, 569, 675, 676, 748, 778, 786, 797,
       955, 968, 1000, 1245, 1271, 1420, 1551, 1694, 2363, 2754, 2950)
t2 <- c(17, 42, 44, 48, 60, 72, 74, 95, 103, 108, 122, 144, 167, 170,
       183, 185, 193, 195, 197, 208, 234, 235, 254, 307, 315, 401, 445,
       464, 484, 528, 542, 547, 577, 580, 795, 855, 1366, 1577, 2060,
       2412, 2486, 2796, 2802, 2934, 2988)
c1 <- c(rep(1, 43), 0, 0)
c2 <- c(rep(1, 39), rep(0, 6))
supControlTest(t1, c1, t2, c2, q.max = 0.5, B = 500)