cgr_helper_mat {cgrcusum}  R Documentation 
This function calculates the value of the CGRCUSUM using a matrix formulation of the problem
cgr_helper_mat(data, ctimes, coxphmod, cbaseh, displaypb = FALSE)
data 
and optionally additional covariates used for riskadjustment. 
ctimes 
(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. 
coxphmod 
(optional) a cox proportional hazards regression model as produced by
the function

cbaseh 
a function which returns the non riskadjusted cumulative
baseline hazard 
displaypb 
boolean Display a progress bar? 
A matrix with 4 named columns:
$time time at which the value of the CGRCUSUM was determined
$value value at corresponding time of the CGRCUSUM
$exp_theta_t value at corresponding time of the MLE \hat{\theta}_t
$S_nu time from which individuals contribute to the chart S_\nu
Daniel Gomon
## Not run:
require(survival)
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()
cgrv1 < cgr_helper_mat(data = tdat, ctimes = unique(tdat$entrytime + tdat$survtime),
coxphmod = tcoxmod, cbaseh = tcbaseh, displaypb = TRUE)
## End(Not run)