不同年龄段的天数,手术治愈费
医学分析:不同年龄段手术存活天数分析_数据 程序  统计学

setwd("C:\\Users\\Administrator\\Desktop\\test")
install.packages("cmprsk")
library(cmprsk)
library(splines)
TCGA <-read.table('input1.3.txt',header=T,sep="\t")
TCGA$Age<-factor(TCGA$Age,labels=c("<40","40-49","50-59","60-69","70-79",">80"))
TCGA$Sex<-factor(TCGA$Sex,labels=c("Female","Male"))
TCGA$Race<-factor(TCGA$Race,labels = c("WHITE ","ASIAN","Others"))
TCGA$Stage_T<-factor(TCGA$Stage_T,labels = c("T1","T2","T3","T4","TX"))
TCGA$Stage_N<-factor(TCGA$Stage_N,labels = c("N0","N1",'NX'))
TCGA$Stage_M<-factor(TCGA$Stage_M,labels = c("M0","M1","MX"))
TCGA$Grade<-factor(TCGA$Grade,labels=c("I","II",'III',"IV","v"))
TCGA$Tumor_size<-factor(TCGA$Tumor_size,labels = c("I","II",'III'))
table(TCGA$Tumor_size)
TCGA$Primary_Site<-factor(TCGA$Primary_Site,labels=c("Upper third of esophagus","Middle third of esophagus","Lower third of esophagus","Overlapping lesion of esophagus","Unknown"))
str(TCGA)
table(TCGA$Primary_site)
TCGA$Operation_method_primary_site<-factor(TCGA$Operation_method_primary_site,labels=c("None surgery","Partial esophagectomy","Total esophagectomy"))
TCGA$Operation_method_LN<-factor(TCGA$Operation_method_LN,labels = c("None","1 to 3 regional lymph nodes removed",'4 or more regional lymph nodes removed'))
TCGA$Marital_status<-factor(TCGA$Marital_status,labels = c("Single","Married"))

#?as.factor
attach(TCGA)
??cuminc
ibrary(cmprsk)
crmod <- cuminc(survival_time,status,Age)
crmod

plot(crmod,xlab = 'day', ylab = 'CIF',lwd=2,lty=1,cex=0.6,
     col = c('blue','black','forestgreen','brown','purple','black','darkmagenta','coral1','darkred','burlywood','darkorange','cadetblue3'))