calc_risk | R Documentation |
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.
calc_risk(data, coxphmod = NULL)
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
|
The subject-specific relative risk is exp(β * Z_i), where β is a vector of regression coefficients and Z_i a vector of covariates for subject i.
A vector of nrow(data)
specifying the increased/decreased
risk of failure for each subject.
Daniel Gomon
#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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.