cpsurv {CPsurv}R Documentation

Nonparametric Change Point Estimation


Change point estimation for survival data based on exact binomial test.


cpsurv(time, event, cpmax, intwd, cpmin = 0, censoring = c("random",
  "type1", "no"), censpoint = NULL, biascorrect = FALSE,
  parametric = FALSE, B.correct = 49, opt.start = c(0.1, 50),
  boot.ci = FALSE, B = 999, conf.level = 0.95, norm.riskset = TRUE,
  seed = NULL, parallel = TRUE, cores = 4L)



Numeric vector with survival times.


Numeric vector indicating censoring status; 0 = alive (censored), 1 = dead (uncensored). If missing, all observations are assumed to be uncensored.


Upper bound for estimated change point. Time period is split into intervals up to this point. Has to be an integer value.


Width of intervals into which the time period is split; default is ceiling(cpmax/20). Has to be an integer value.


Lower bound for estimated change point; default is cpmin=0. Has to be an integer value.


Type of right-censoring for simulated data on which the bootstrap bias correction is based. Possible types are "random" for random censoring (default), "type1" for Type I censoring or "no" for data without censored observations. Because simulated data should be similar to given data, the censoring type is adapted from vector 'events' if given and argument 'censoring' is ignored than.


Point of Type I censoring; if missing, minimum time after which all events are equal to 0 is used. Censpoint is only needed for bootstrap bias correction.


Logical; if TRUE, a bootstrap bias correction is performed; see 'Details'.


Indicator for parametric bias-correction (see Details for more information).


Number of bootstrap samples for bias-correction; defaults to 49.


Numeric vector of length two; initial values for the Weibull parameters (shape and scale parameters) to be optimized if parametric bootstrap bias correction is used.


Indicator if confidence intervals (and thereby standard deviation) should be calculated by bootstrap sampling. Please note the extended runtime (see details for examples).


Number of bootstrap samples for confidence intervals; defaults to 999.


Confidence level for bootstrap confidence intervals.


Logical; if TRUE normalized number of units at risk is used within an interval.


Seed for random number generator (optional).


Indicator if bootstrap-sampling is executed parallelized (based on package 'parallel'); operating system is identified automatically.


Number of CPU-cores that are used for parallelization; maximum possible value is the detected number of logical CPU cores.


Change point is a point in time, from which on the hazard rate is supposed to be constant. For its estimation the timeline up to cpmax is split into equidistant intervals of width intwd and exact binomial tests are executed for each interval. The change point is estimated by fitting a regression model on the resulting p-values. See Brazzale et al (2017) for details.

For bootstrap bias correction the change point is estimated for a given number (B.correct) of bootstrap samples whereupon the bias is built by subtracting their median from primary estimation. Depending on argument parametric the data for bootstrapping are simulated either parametric (Weibull distributed with estimated shape and scale parameters) or nonparametric (based on Kaplan-Meier estimation).


cp estimated change point
p.values p-values resulting from exact binomial test
pv.mean mean of p-values for intervals above the estimated change point
lower.lim lower interval limits
upper.lim upper interval limits
cp.bc bias corrected change point
ml.shape ML estimator of shape parameter for Weibull distribution
ml.scale ML estimator of scale parameter for Weibull distribution
cp.boot estimated change points for bootstrap samples
sd standard deviation estimated by bootstrap sampling
ci.normal confidence interval with normal approximation
ci.percent bootstrap percentile interval
conf.level the conf.level argument passed to cpsurv
B the B argument passed to cpsurv
time the time argument passed to cpsurv
event the event argument passed to cpsurv
cpmax the cpmax argument passed to cpsurv
intwd the intwd argument passed to cpsurv
call matched call


Stefanie Krügel stefanie.kruegel@gmail.com


Brazzale, A. R. and Küchenhoff, H. and Krügel, S. and Hartl, W. (2017) Nonparametric change point estimation for survival distributions with a partially constant hazard rate.


# estimate change point for survdata (random censored)
cp <- cpsurv(survdata$time, survdata$event, cpmax = 360, intwd = 20)

## Not run: 
# estimation with parametric bootstrap bias correction
cp_param <- cpsurv(survdata$time, survdata$event, cpmax = 360, intwd = 20,
            biascorrect = TRUE, parametric = TRUE)

# with bootstrap confidence intervals and parametric bootstrap bias
cp_ci <- cpsurv(survdata$time, survdata$event, cpmax = 360, intwd = 20,
biascorrect = TRUE, parametric = FALSE, boot.ci = TRUE, cores = 4, seed = 36020)
# runtime: approx. 180 min (with Intel(R) Core(TM) i7 CPU 950 @ 3.07GHz, 4 logical CPUs used)

## End(Not run)

[Package CPsurv version 1.0.0 Index]