calc_risk {cgrcusum}R Documentation

Calculate the Cox risk associated with the covariates of the individual

Description

This function can be used to calculate the risk associated with the covariates of an individual under a specified Cox PH model.

Usage

calc_risk(data, coxphmod = NULL)

Arguments

data

data frame containing the covariates to be used for risk-adjustment as named columns.

coxphmod

(optional) a cox proportional hazards model generated using coxph() or a list containing:

  • $formula (~ covariates),

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

Details

The subject specific increased risk is given by:

e^{\beta Z_i}

with \beta the Cox coefficients and Z_i the covariates of subject i.

Value

A vector of nrow(data) specifying the increased risk of failure for each subject.

Author(s)

Daniel Gomon

See Also

Other utils: exp_hazards, gen_arriv_times(), gen_surv_times(), runlength()

Examples

crdat <- data.frame(age = rnorm(10, 40, 5), BMI = rnorm(10, 24, 3))
crlist <- list(formula = as.formula("~age + BMI"), coefficients = c("age"= 0.02, "BMI"= 0.009))
calc_risk(crdat, crlist)

[Package cgrcusum version 0.1.0 Index]