calc_risk {success}R Documentation

Calculate the Cox Proportional hazards relative risk associated with the covariates of subjects

Description

This function can be used to calculate the change in the relative risk of a subject pertaining to their covariates under a specified Cox proportional hazards model.

Usage

calc_risk(data, coxphmod = NULL)

Arguments

data

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

a formula() in the form ~ covariates;

coefficients:

a named vector specifying risk adjustment coefficients for covariates. Names must be the same as in formula and colnames of data.

Details

The subject-specific relative risk is e^{\beta Z_i}, where \beta is a vector of regression coefficients and Z_i a vector of covariates for subject i.

Value

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

Author(s)

Daniel Gomon

Examples

#Small example data
crdat <- data.frame(age = rnorm(10, 40, 5), BMI = rnorm(10, 24, 3))
#Example risk-adjustment list (can also specify coxphmod)
crlist <- list(formula = as.formula("~age + BMI"), coefficients = c("age"= 0.02, "BMI"= 0.009))
#Calculate the increase or decrease of the relative risk for the subjects
#in crdat.
calc_risk(crdat, crlist)

[Package success version 1.1.0 Index]