cgr_helper_mat_3 {cgrcusum}R Documentation

Continuous time Generalized Rapid response CUSUM (CGR-CUSUM) helper - matrix formulation of the problem - version 3


This function calculates the value of the CGR-CUSUM using a matrix formulation of the problem - reduce calculations by specifying control limit.


cgr_helper_mat_3(data, ctimes, coxphmod, cbaseh, h, displaypb = FALSE)



data.frame containing the following named columns:

  • entrytime numeric - time of entry into study,

  • otime numeric - time from entry until event,

  • censorid integer - (optional) censoring indicator (0 = right censored, 1 = observed),

and optionally additional covariates used for risk-adjustment.


(optional) vector of construction times at which the value of the chart should be determined. When not specified, the chart is constructed at all failure times.


(optional) a cox proportional hazards regression model as produced by the function coxph(). Standard practice:
coxph(Surv(survtime, censorid) ~ covariates, data = data).
Alternatively, a list with:

  • $formula (~ covariates)

  • $coefficients (named vector specifying risk adjustment coefficients for covariates - names must be the same as in $formula and colnames of data).


a function which returns the non risk-adjusted cumulative baseline hazard H_0(t). If cbaseh is missing but coxphmod has been specified as a survival object, this baseline hazard rate will be determined using the provided coxphmod.


(optional) value of the control limit. The chart will only be constructed until the value of the control limit has been reached or surpassed.


boolean Display a progress bar?


A matrix with 4 named columns:


Daniel Gomon

See Also



## Not run: 
tdat <- subset(surgerydat, Hosp_num == 1)
tdat$otime <- tdat$entrytime + tdat$survtime
tcbaseh <- function(t) chaz_exp(t, lambda = 0.01)
varsanalysis <- c("age", "sex", "BMI")
exprfit <- as.formula(paste("Surv(survtime, censorid) ~" ,paste(varsanalysis, collapse='+')))
tcoxmod <- coxph(exprfit, data= surgerydat)
#Alternatively, cbaseh can be left empty when specifying coxphmod through coxph()
cgr3 <- cgr_helper_mat_3(data = tdat, ctimes = unique(tdat$entrytime + tdat$survtime),
                         coxphmod = tcoxmod, cbaseh = tcbaseh, displaypb = TRUE)

## End(Not run)

[Package cgrcusum version 0.1.0 Index]