Rによる生存曲線の書き方
二つのサイト
R Textbook Examples
Applied Survival Analysis
Rと生存時間分析
が詳しい。
#ID, OS, Status, DrugからなるTableを作る!
#ID= Patient Number,OS =length of time, Status =Death or Not, Drug=Control or test
>library(survival)
#ファイルの読み込み
>t <- read.table(file="FILE NAME.txt",header=T,sep="t",row.names=1)
#分析
>attach(t)
>t.surv <- survfit( Surv(OS, Status)~ Drug conf.type="none")
>summary(t.surv)
#KMプロット作成
>plot (t.surv,lty=1:2, xlab="Time", ylab="Survival Probability" )
legend(locator(1),c("Drug -","Drug +"),lty=c(1,2))
#Statistical analysis
survdiff(Surv(OS)~Drug,data=t)
二つのサイト
R Textbook Examples
Applied Survival Analysis
Rと生存時間分析
が詳しい。
#ID, OS, Status, DrugからなるTableを作る!
#ID= Patient Number,OS =length of time, Status =Death or Not, Drug=Control or test
>library(survival)
#ファイルの読み込み
>t <- read.table(file="FILE NAME.txt",header=T,sep="t",row.names=1)
#分析
>attach(t)
>t.surv <- survfit( Surv(OS, Status)~ Drug conf.type="none")
>summary(t.surv)
#KMプロット作成
>plot (t.surv,lty=1:2, xlab="Time", ylab="Survival Probability" )
legend(locator(1),c("Drug -","Drug +"),lty=c(1,2))
#Statistical analysis
survdiff(Surv(OS)~Drug,data=t)