如何从R

时间:2019-03-21 12:38:14

标签: r survival-analysis hazard

我已经拟合了具有显着协变量的多元cox比例模型。拟合测试数据后,预测函数可以清楚地返回危险比(从正值到负值)。这对我来说显然很有意义,因为负面情绪越强,他们死亡的可能性就越小。

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))

我想知道如何计算危险率而不是比率。

0 个答案:

没有答案