Skip to contents

Non-parametric inference for survival outcomes supporting censored data, using the Peto-Prentice modification of the Gehan-Wilcoxon test. The treatment effect estimate is the mean difference in Peto-Prentice weighted martingale residuals between the treatment and control groups. Specifically, for each subject the weighted residual is \(M_i^w = \hat{S}(t_i^-) \cdot M_i\), where \(M_i = \delta_i - \hat\Lambda_0(t_i)\) is the martingale residual and \(\hat{S}(t_i^-)\) is the overall Kaplan-Meier survival estimate just before time \(t_i\). These weights downweight late events, analogously to the Wilcoxon rank-sum test for uncensored data (which also weights early observations more heavily via their larger rank denominator).

The p-value uses survival::survdiff(rho = 1) (Peto-Prentice / Fleming-Harrington p=1, q=0), which is distinct from the log-rank test (rho = 0) used in InferenceSurvivalKMDiff.

References

Gehan, E. A. (1965). "A generalized Wilcoxon test for comparing arbitrarily singly-censored samples." Biometrika, 52(1-2), 203-223, doi:10.1093/biomet/52.1-2.203 , for the original generalized (Gehan) Wilcoxon test for censored data. Peto, R., and Peto, J. (1972). "Asymptotically Efficient Rank Invariant Test Procedures." Journal of the Royal Statistical Society, Series A, 135(2), 185-207, doi:10.2307/2344317 , for the survival-weighted (Peto-Prentice) modification this class implements via \(\rho=1\).

Super class

Inference -> InferenceSurvivalGehanWilcox

Methods

+ inherited public methods from Inference


InferenceSurvivalGehanWilcox$new()

Uses the shared randomization two-sided p-value contract; see InferenceRand.

Initialize Gehan-Wilcoxon survival inference and prepare the rank-based treatment statistic used by InferenceSurvivalGehanWilcox.

Usage

InferenceSurvivalGehanWilcox$new(
  des_obj,
  model_formula = NULL,
  verbose = FALSE
)

Arguments

des_obj

The design object.

model_formula

Optional formula for covariate adjustment. If NULL (default), the formula from the design object is used and its pre-computed design matrix is reused. If a formula is provided, a new design matrix is constructed from the design's imputed covariates.

verbose

If TRUE, print additional information.


InferenceSurvivalGehanWilcox$compute_estimate()

Returns the mean difference in Peto-Prentice weighted martingale residuals between the treatment and control groups. Positive values indicate that treatment subjects experienced fewer early events than expected. For left- or interval-censored data, dispatches instead to interval::ictest(..., scores = "wmw") (the Wilcoxon-Mann-Whitney interval-censored generalization of the Peto-Prentice test) and returns its estimate.

Usage

InferenceSurvivalGehanWilcox$compute_estimate(estimate_only = FALSE)

Arguments

estimate_only

If TRUE, skip variance component calculations.

Returns

A numeric scalar (the Peto-Prentice weighted score treatment effect estimate).

Examples

seq_des = DesignSeqOneByOneBernoulli$new(n = 6, response_type = "survival")
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[1, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[2, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[3, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[4, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[5, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[6, 2:10])
seq_des$add_all_subject_responses(
  ys = c(4.71, NA, 4.78, 6.11, NA, 8.43),
  y_Ls = c(NA, 1.23, NA, NA, 5.95, NA),
  y_Rs = c(NA, Inf, NA, NA, Inf, NA)
)

seq_des_inf = InferenceSurvivalGehanWilcox$new(seq_des)
seq_des_inf$compute_estimate()


InferenceSurvivalGehanWilcox$compute_estimate_with_bootstrap_weights()

Recomputes the class-specific treatment estimate under bootstrap weights; see InferenceBayesianBootstrap.

Usage

InferenceSurvivalGehanWilcox$compute_estimate_with_bootstrap_weights(
  subject_or_block_weights,
  estimate_only = FALSE
)

Arguments

subject_or_block_weights

Bootstrap weights at the subject or block level.

estimate_only

If TRUE, skip variance calculations.


InferenceSurvivalGehanWilcox$compute_asymp_confidence_interval()

Computes a (1 - alpha)-level confidence interval based on the asymptotic normality of the Peto-Prentice weighted martingale residual mean difference. Falls back to bootstrap if the SE is unavailable.

Usage

InferenceSurvivalGehanWilcox$compute_asymp_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level. Default is 0.05.

Returns

A numeric vector of length 2: (lower, upper) confidence bounds.

Examples

seq_des = DesignSeqOneByOneBernoulli$new(n = 6, response_type = "survival")
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[1, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[2, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[3, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[4, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[5, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[6, 2:10])
seq_des$add_all_subject_responses(
  ys = c(4.71, NA, 4.78, 6.11, NA, 8.43),
  y_Ls = c(NA, 1.23, NA, NA, 5.95, NA),
  y_Rs = c(NA, Inf, NA, NA, Inf, NA)
)

seq_des_inf = InferenceSurvivalGehanWilcox$new(seq_des)
seq_des_inf$compute_asymp_confidence_interval()


InferenceSurvivalGehanWilcox$compute_asymp_two_sided_pval()

Computes the Peto-Prentice (Gehan-Wilcoxon) two-sided p-value via survival::survdiff(rho = 1), which puts greater weight on early events relative to the standard log-rank test (rho = 0). For delta != 0, not yet implemented.

Usage

InferenceSurvivalGehanWilcox$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect to test against. Default is 0.

Returns

A p-value in [0, 1].

Examples

seq_des = DesignSeqOneByOneBernoulli$new(n = 6, response_type = "survival")
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[1, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[2, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[3, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[4, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[5, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[6, 2:10])
seq_des$add_all_subject_responses(
  ys = c(4.71, NA, 4.78, 6.11, NA, 8.43),
  y_Ls = c(NA, 1.23, NA, NA, 5.95, NA),
  y_Rs = c(NA, Inf, NA, NA, Inf, NA)
)

seq_des_inf = InferenceSurvivalGehanWilcox$new(seq_des)
seq_des_inf$compute_asymp_two_sided_pval()


InferenceSurvivalGehanWilcox$compute_rand_confidence_interval()

Randomization confidence intervals are not supported for this class because the Peto-Prentice weighted score scale is not commensurate with the time-ratio null used by the randomization CI bisection algorithm.

Usage

InferenceSurvivalGehanWilcox$compute_rand_confidence_interval(
  alpha = 0.05,
  r = 501,
  pval_epsilon = 0.005,
  show_progress = TRUE,
  ci_search_control = NULL
)

Arguments

alpha

Unused.

r

Unused.

pval_epsilon

Unused.

show_progress

Unused.

ci_search_control

Unused.


InferenceSurvivalGehanWilcox$clone()

The objects of this class are cloneable with this method.

Usage

InferenceSurvivalGehanWilcox$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# \donttest{
seq_des = DesignSeqOneByOneBernoulli$new(n = 10, response_type = 'survival')
for (i in 1:10) {
  seq_des$add_one_subject_to_experiment_and_assign(data.frame(x1 = rnorm(1)))
}
seq_des$add_all_subject_responses(runif(10))
inf = InferenceSurvivalGehanWilcox$new(seq_des)
inf$compute_estimate()
#> [1] 0.03583003
# }

## ------------------------------------------------
## Method `InferenceSurvivalGehanWilcox$compute_estimate()`
## ------------------------------------------------

seq_des = DesignSeqOneByOneBernoulli$new(n = 6, response_type = "survival")
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[1, 2:10])
#> [1] 0
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[2, 2:10])
#> [1] 1
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[3, 2:10])
#> [1] 0
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[4, 2:10])
#> [1] 0
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[5, 2:10])
#> [1] 0
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[6, 2:10])
#> [1] 0
seq_des$add_all_subject_responses(
  ys = c(4.71, NA, 4.78, 6.11, NA, 8.43),
  y_Ls = c(NA, 1.23, NA, NA, 5.95, NA),
  y_Rs = c(NA, Inf, NA, NA, Inf, NA)
)

seq_des_inf = InferenceSurvivalGehanWilcox$new(seq_des)
seq_des_inf$compute_estimate()
#> [1] -0.143

## ------------------------------------------------
## Method `InferenceSurvivalGehanWilcox$compute_asymp_confidence_interval()`
## ------------------------------------------------

if (FALSE) { # \dontrun{
seq_des = DesignSeqOneByOneBernoulli$new(n = 6, response_type = "survival")
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[1, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[2, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[3, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[4, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[5, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[6, 2:10])
seq_des$add_all_subject_responses(
  ys = c(4.71, NA, 4.78, 6.11, NA, 8.43),
  y_Ls = c(NA, 1.23, NA, NA, 5.95, NA),
  y_Rs = c(NA, Inf, NA, NA, Inf, NA)
)

seq_des_inf = InferenceSurvivalGehanWilcox$new(seq_des)
seq_des_inf$compute_asymp_confidence_interval()
} # }

## ------------------------------------------------
## Method `InferenceSurvivalGehanWilcox$compute_asymp_two_sided_pval()`
## ------------------------------------------------

if (FALSE) { # \dontrun{
seq_des = DesignSeqOneByOneBernoulli$new(n = 6, response_type = "survival")
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[1, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[2, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[3, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[4, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[5, 2:10])
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[6, 2:10])
seq_des$add_all_subject_responses(
  ys = c(4.71, NA, 4.78, 6.11, NA, 8.43),
  y_Ls = c(NA, 1.23, NA, NA, 5.95, NA),
  y_Rs = c(NA, Inf, NA, NA, Inf, NA)
)

seq_des_inf = InferenceSurvivalGehanWilcox$new(seq_des)
seq_des_inf$compute_asymp_two_sided_pval()
} # }