cgr_helper_mat_2: Continuous time Generalized Rapid response CUSUM (CGR-CUSUM)...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/cgr_helper_mat_2.R

Description

This function calculates the value of the CGR-CUSUM using a matrix formulation of the problem - this can require a lot of available RAM.

Usage

1
cgr_helper_mat_2(data, ctimes, coxphmod, cbaseh, displaypb = FALSE)

Arguments

data

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.

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 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).

cbaseh

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.

displaypb

boolean Display a progress bar?

Value

A matrix with 4 named columns:

Author(s)

Daniel Gomon

See Also

cgrcusum

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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()
cgr2 <- cgr_helper_mat_2(data = tdat, ctimes = unique(tdat$entrytime + tdat$survtime),
                         coxphmod = tcoxmod, cbaseh = tcbaseh, displaypb = TRUE)

## End(Not run)

cgrcusum documentation built on Nov. 22, 2021, 9:09 a.m.