calc_risk: Calculate the Cox risk associated with the covariates of the...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/calc_risk.R

Description

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

Usage

1
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:

exp(β * Z_i)

with β 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

1
2
3
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)

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