全民炸金花_澳门电子游戏-app下载

图片

区分的指数ハザード

指数分布とポアソン分布の関係
指数分布:イベント発生までの時間分布
ポアソン分布:一定時間内における発生イベント数の分布

library(survival)
## Loading required package: splines
data(stanford2)
stanford2 <- subset(stanford2, !is.na(stanford2$t5))
# 指数ハザード
res.e <- survreg(Surv(time, status) ~ age + t5, stanford2, dist = "exponential")
# ポアソン回帰
res.p <- glm(status ~ offset(log(time)) + age + t5, stanford2, family = "poisson")
# 回帰係数の比較
-res.e$coef
## (Intercept)         age          t5 
##    -9.05376     0.03926     0.29742 
res.p$coef
## (Intercept)         age          t5 
##    -9.05376     0.03926     0.29742 

区分的指数ハザードに基づく推定

# 区分的指数ハザード
brks <- c(sort(unique(stanford2$time)))
d <- survSplit(stanford2, brks, end = "time", start = "start", event = "status", 
    id = "tid", zero = 0)
d$tid <- as.integer(d$tid)
d <- d[order(d$tid), ]
d$risk.time <- d$time - d$start
d$t.pseudo <- cut(d$start, breaks = c(0, brks), include.lowest = T, 
    right = F)
res.pe.p <- glm(status ~ offset(log(risk.time)) - 1 + t.pseudo + 
    age + t5, d, family = "poisson", x = T)
res.pe.e <- survreg(Surv(risk.time, status) ~ -1 + t.pseudo + age + 
    t5, d, dist = "exponential", x = T)
res.cox <- coxph(Surv(time, status) ~ age + t5, stanford2, method = "breslow")
# 回帰係数の比較
res.pe.p$coef[grep("age|t5", names(res.pe.p$coef))]
##     age      t5 
## 0.02955 0.16956 
-res.pe.e$coef[grep("age|t5", names(res.pe.e$coef))]
##     age      t5 
## 0.02955 0.16954 
res.cox$coef[grep("age|t5", names(res.cox$coef))]
##     age      t5 
## 0.02955 0.16956