我在R中进行生存分析,并希望预测年龄组的生存时间,例如20-29; 30-39; 40-49等,BMI 15-18.5; 19-24.9; 25-29.9等我需要帮助将年龄和BMI分组进行分析。
Event Time Age Bmi Gender Smoke Stroke 0 80 16 16.5 2 0 2 1 79 19 18.5 1 1 2 0 80 21 20 2 0 2 1 79 23 23 1 1 1 0 80 34 34 2 0 1 1 79 37 35 1 1 1 0 80 43 22 2 0 1 1 79 48 24 1 1 2 0 80 52 41 2 0 2 1 79 54 45 1 1 2
答案 0 :(得分:0)
我无法在没有数据的情况下进行测试,但这应该是理念:
breaks_age <- seq(from = 0, to = 100, by = 10)
breaks_bmi <- seq(from = 0, to = 100, by = 5)
df$cutpoint_age <- cut(df$age,breaks=breaks_age , right=FALSE)
df$cutpoint_BMI <- cut(df$BMI,breaks=breaks_bmi , right=FALSE)