差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
r:survival [2018/12/09 22:00] – watalu | r:survival [2018/12/11 19:42] (現在) – watalu | ||
---|---|---|---|
行 1: | 行 1: | ||
==== Rによる生存時間解析 ==== | ==== Rによる生存時間解析 ==== | ||
- | [[r: | + | [[r: |
+ | |||
+ | * [[r: | ||
+ | * [[r: | ||
+ | * [[r: | ||
+ | |||
+ | ただし、実験の内容を実施するためには、上の3つのページは読まずとも問題なく、下の説明に従って進めれば十分である。 | ||
=== データの書き方 === | === データの書き方 === | ||
行 99: | 行 105: | ||
< | < | ||
- | draw.reliability.data.diagram(X) | + | plot.reliability.data.diagram(X) |
</ | </ | ||
行 290: | 行 296: | ||
</ | </ | ||
- | これらをカプラン・マイヤー曲線に重ねて描く関数も用意した。 | + | これらをカプラン・マイヤー曲線に重ねて描く関数compare.KM.and.distributions.2 |
- | + | ||
- | < | + | |
- | compare.KM.and.distributions.2 | + | |
- | require(survival) | + | |
- | km <- survfit(Surv(time, | + | |
- | fits <- compare.histgram.and.densities(data, | + | |
- | survreg.weibull <- survreg(Surv(time, | + | |
- | fits$weibull$estimate[1] <- 1/ | + | |
- | fits$weibull$estimate[2] <- exp(survreg.weibull$coefficients[1]) | + | |
- | survreg.lognormal <- survreg(Surv(time, | + | |
- | fits$lnorm$estimate[1] <- survreg.lognormal$coefficients[1] | + | |
- | fits$lnorm$estimate[2] <- survreg.lognormal$scale | + | |
- | plot(km, | + | |
- | | + | |
- | | + | |
- | plot(function(x) pweibull(x, | + | |
- | lower.tail=FALSE), | + | |
- | | + | |
- | plot(function(x) plnorm(x, | + | |
- | lower.tail=FALSE), | + | |
- | | + | |
- | legend(" | + | |
- | | + | |
- | paste(" | + | |
- | paste(" | + | |
- | | + | |
- | } | + | |
- | </ | + | |
< | < | ||
compare.KM.and.distributions.2(X) | compare.KM.and.distributions.2(X) | ||
</ | </ |