How can you extract hazard rate(s) from an cox proportions model in R

737 Views Asked by At

I've fit a multivariate cox proportions model with significant covariates. After fitting test data, the predict function clearly returns hazard ratios (ranging from positive values to negative values). This clearly makes sense to me as the more negative it is the less likely they are to die.

res.cox <- coxph(Surv(wins, status) ~ out_degree +  ADJOE + ADJDE + Luck, data =  train_df)

test_df$pred <- predict(res.cox,test_df)
train_df = structure(list(year = c(2004, 2004, 2004, 2004, 2004, 2004), 
    TeamID = c("1448", "1338", "1386", "1462", "1163", "1305"
    ), out_degree = c(8, 7, 6, 7, 8, 5), in_degree = c(7, 4, 
    1, 4, 5, 3), ADJOE = c(121.6, 114.1, 118.9, 113.8, 117.8, 
    112.3), ADJDE = c(99.9, 88.2, 91.2, 93.6, 89.5, 92), Luck = c(-0.019, 
    -0.028, 0.06, -0.022, 0.012, -0.039), wins = c(2, 2, 3, 3, 
    6, 2), status = c(2, 2, 2, 2, 1, 2)), class = c("tbl_df", 
"tbl", "data.frame"), row.names = c(NA, -6L))

test_df = structure(list(year = c(2019, 2019, 2019, 2019, 2019, 2019), 
    TeamID = c("1113", "1120", "1138", "1181", "1199", "1211"
    ), out_degree = c(5, 7, 1, 13, 9, 5), in_degree = c(3, 7, 
    1, 5, 5, 3), ADJOE = c(109.4, 119.6, 115, 120.2, 113.1, 125.3
    ), ADJDE = c(97.8, 96.4, 94.7, 88.3, 90.6, 92.6), Luck = c(0.05, 
    0.003, 0.041, 0.018, 0.045, 0.008)), class = c("tbl_df", 
"tbl", "data.frame"), row.names = c(NA, -6L))

I was wondering how to calculate Hazard Rate(s) instead of ratios.

0

There are 0 best solutions below