Fitting a Cox regression model
# Load the survival library
library(survival)
# Loading the kidney dataset
data <- kidney
# Fit the Cox regression model
cox_model <- coxph(Surv(time, status) ~ age + sex + disease + frail, data = data)
# Print the summary of the model
summary(cox_model)
## Call:
## coxph(formula = Surv(time, status) ~ age + sex + disease + frail,
## data = data)
##
## n= 76, number of events= 58
##
## coef exp(coef) se(coef) z Pr(>|z|)
## age 0.007714 1.007744 0.011907 0.648 0.517055
## sex -2.099844 0.122475 0.392654 -5.348 8.90e-08 ***
## diseaseGN 0.130666 1.139587 0.436114 0.300 0.764471
## diseaseAN 0.640906 1.898200 0.447886 1.431 0.152442
## diseasePKD -2.168515 0.114347 0.648825 -3.342 0.000831 ***
## frail 1.791873 6.000682 0.257639 6.955 3.53e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## age 1.0077 0.9923 0.98450 1.0315
## sex 0.1225 8.1649 0.05673 0.2644
## diseaseGN 1.1396 0.8775 0.48476 2.6790
## diseaseAN 1.8982 0.5268 0.78904 4.5665
## diseasePKD 0.1143 8.7453 0.03206 0.4079
## frail 6.0007 0.1666 3.62158 9.9427
##
## Concordance= 0.822 (se = 0.03 )
## Likelihood ratio test= 68.71 on 6 df, p=8e-13
## Wald test = 60.01 on 6 df, p=4e-11
## Score (logrank) test = 86.24 on 6 df, p=<2e-16
The coefficient for age is 0.007714, and the hazard ratio is 1.007744. However, the p-value (0.517055) suggests that age is not statistically significant in predicting the hazard of the event. The 95% confidence interval for the hazard ratio includes 1, indicating that the effect of age on the hazard of the event is not statistically significant.
The coefficient for sex is -2.099844, indicating that being male is associated with a lower hazard of the event. The hazard ratio of 0.122475 suggests that males have approximately an 88% lower hazard compared to females. This effect is statistically significant, as the p-value is highly significant (8.90e-08).
The coefficients for different disease categories (GN, AN, PKD) indicate the association between each disease category and the hazard of the event. However, none of the disease categories show statistically significant associations with the hazard of the event. The p-values for diseaseGN (0.764471), diseaseAN (0.152442), and diseasePKD (0.000831) suggest no significant associations. It is important to note that the diseasePKD category has a hazard ratio of 0.1143, indicating a substantially lower hazard compared to the reference category.
The coefficient for frailty is 1.791873, suggesting that being frail is associated with a higher hazard of the event. The hazard ratio of 6.000682 indicates that frail individuals have approximately a 6-fold higher hazard compared to non-frail individuals. This effect is highly statistically significant, with a very low p-value (3.53e-12).
Hence, being male and frail are both strongly associated with a higher hazard of the event. Age and the specific disease categories (GN, AN, PKD) do not appear to have significant associations with the hazard of the event in this analysis.