
大家好,我上面有這個情節。我想提取y軸值(累積危害%)來找出吸煙者和非吸煙者在隨訪期結束時的危害。這是我用來創建情節的代碼:
survmod1 <- survfit(Surv(timedth, death)~cursmoke, data=frmgham_recoded,
conf.type="log-log") #force confidence intervals to be bounded between 0 and 1
plot(survmod1,
main="Kaplan-Meier Failure Estimates by smoking status",
xlab="Time (days)", ylab="Cumulative Hazard",
fun="event", #transforms data into failure event function, plots the complement
bty="l", col=c("darkblue","darkorange"))
legend("bottomright",legend=c("no","yes"),
lty=1, lwd=2,
col=c("darkblue","darkorange"),
cex=0.8,bty="o")
uj5u.com熱心網友回復:
在我看來,您的 survfit 物件已經包含累積危險資料。嘗試survmod1$cumhaz獲取這些資料。
uj5u.com熱心網友回復:
嘗試:這應該給你 time n.risk n.event survival std.err lower 95% CI upper 95% CI。您可以根據需要調整時間順序。
library(survival)
library(survminer)
summary(survmod1, times = seq(0, 8000, 2000))
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/342979.html
標籤:r
上一篇:按組劃分的dplyr中位數
