




下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、-. z.隨機森林模型在生存分析中的應用【摘要】目的:本文探討隨機森林方法用于高維度、強相關、小樣本的生存資料分析時,可以起到變量篩選的作用。方法:以乳腺癌數據集構建乳腺癌轉移風險評估模型為實例進展實證分析,使用隨機森林模型進展變量選擇,然后擬合co*回歸模型。結果:隨機森林模型通過對變量的選擇,有效的解決數據維度高且強相關的情況,得到了較高的AUC值。一、數據說明該乳腺癌數據集來自于NCBI,有77個觀測值以及22286個基因變量。通過篩選選取454個基因變量。將數據隨機分為訓練集合測試集,其中2/3為訓練集,1/3為測試集。繪制K-M曲線圖:二、隨機森林模型隨機森林由許多的決策樹組成,因為
2、這些決策樹的形成采用了隨機的方法,因此也叫做隨機決策樹。隨機森林中的樹之間是沒有關聯的。當測試數據進入隨機森林時,其實就是讓每一顆決策樹進展分類,最后取所有決策樹中分類結果最多的那類為最終的結果。因此隨機森林是一個包含多個決策樹的分類器,并且其輸出的類別是由個別樹輸出的類別的眾數而定。使用 randomForestSRC包得到的隨機森林模型具有以下性質: Number of deaths: 27 Number of trees: 800 Minimum terminal node size: 3 Average no. of terminal nodes: 14.4275No. of vari
3、ables tried at each split: 3 Total no. of variables: 452 Analysis: RSF Family: surv Splitting rule: logrank Error rate: 19.87%發現直接使用隨機森林得到的模型,預測誤差很大,到達了19.8%,進一步考慮使用隨機森林模型進展變量選擇,結果如下: Sample size: 52 Number of deaths: 19 Number of trees: 500 Minimum terminal node size: 2 Average no. of terminal node
4、s: 11.554No. of variables tried at each split: 3 Total no. of variables: 9 Analysis: RSF Family: surv Splitting rule: logrank *random* Number of random split points: 10 Error rate: 11.4% our.rf$topvars1 213821_s_at 219778_at 204690_at 220788_s_at 202202_s_at6 211603_s_at 213055_at 219336_s_at 37892_
5、at 一共選取了9個變量,同時誤差只有11.4%接下來,使用這些變量做co*回歸,剔除模型中不顯著0.01的變量,最終參與模型建立的變量共有4個。模型結果如下: e*p(coef) e*p(-coef) lower .95 upper .95218150_at 1.6541 0.6046 0.11086 24.6800200914_*_at 0.9915 1.0086 0.34094 2.8833220788_s_at 0.2649 3.7750 0.05944 1.1805201398_s_at 1.7457 0.5729 0.33109 9.2038201719_s_at 2.4708 0
6、.4047 0.93808 6.5081202945_at 0.4118 2.4284 0.03990 4.2499203261_at 3.1502 0.3174 0.33641 29.4983203757_s_at 0.7861 1.2720 0.61656 1.0024205068_s_at 0.1073 9.3180 0.02223 0.5181最后選取六個變量擬合生存模型,繪制生存曲線如下:下面繪制ROC曲線,分別在訓練集和測試集上繪制ROC曲線,結果如下:訓練集:測試集:由于測試集上的樣本過少,所以得到的AUC值波動大,考慮使用bootstrap屢次計算訓練集上的AUC值并求平均來測
7、試模型的效果:AUC at 1 year:0.8039456AUC at 3 year:0.6956907AUC at 5 year:0.7024846由此可以看到,隨機森林通過刪除奉獻較低的變量,完成變量選擇的工作,在測試集上具有較高的AUC值,但是比lasso-co*模型得到的AUC略低。附錄:load(/R/brea.rda)library(survival)set.seed(10)i-sample(1:77,52)train-dati,test-dat-i,library(randomForestSRC)disease.rf-rfsrc(Surv(time,status).,data
8、= train, ntree = 800,mtry = 3, nodesize = 3,splitrule = logrank)disease.rfour.rf- var.select(object=disease.rf, vdv, method = vh.vimp, nrep = 50)our.rf$topvarsinde*-numeric(var.rf$modelsize)for(i in 1:var.rf$modelsize) inde*i-which(names(dat)=var.rf$topvarsi)data-dat,c(1,2,inde*)i-sample(1:77,52)tra
9、in-datai,test-data-i,mod.brea-co*ph(Surv(time,status).,data=train)train_data-train,c(1,2,which(summary(mod.brea)$coefficients,5=0.1)+2)tset_data-test,c(1,2,which(summary(mod.brea)$coefficients,5=0.1)+2)mod.brea1-co*ph(Surv(time,status).,data=train_data)summary(mod.brea1)names(coef(mod.brea1)plot(sur
10、vfit(mod.brea1),*lab=Time,ylab = Proportion,main=Co* Model,=TRUE,col=c(black,red,red),ylim=c(0.6,1)inde*0-numeric(length(coef(mod.brea1)coefficients-coef(mod.brea1)name-gsub(,names(coefficients)for(j in 1:length(inde*0) inde*0j-which(names(dat)=namej)library(survivalROC)riskscore-as.matri*(d
11、ati,inde*0)%*% as.matri*(coefficients)y1-survivalROC(Stime=train$time,status=train$status,marker=riskscore,predict.time=1,span = 0.25*(nrow(train)(-0.20)y3-survivalROC(Stime=train$time,status=train$status,marker=riskscore,predict.time=3,span = 0.25*(nrow(train)(-0.20)y5-survivalROC(Stime=train$time,
12、status=train$status,marker=riskscore,predict.time=5,span = 0.25*(nrow(train)(-0.20)a-matri*(data=c(y1,y3,y5,y1$AUC,y3$AUC,y5$AUC),nrow=3,ncol=2);aplot(y1$FP,y1$TP,type=l,*lab=False Positive Rate,ylab = True Positive Rate,main=Time-dependent ROC curve,col=green) lines(y3$FP,y3$TP,col=red,lty=2)lines(
13、y5$FP,y5$TP,col=blue,lty=3)legend(bottomright,bty=n,legend = c(AUC at 1 year:0.9271,AUC at 3 years:0.8621,AUC at 5 years:0.8263),col=c(green,red,blue),lty=c(1,2,3),ce*=0.9)abline(0,1)riskscore-as.matri*(dat-i,inde*0)%*% as.matri*(coefficients)y1-survivalROC(Stime=test$time,status=test$status,marker=
14、riskscore,predict.time=1,span = 0.25*(nrow(train)(-0.20)y3-survivalROC(Stime=test$time,status=test$status,marker=riskscore,predict.time=3,span = 0.25*(nrow(train)(-0.20)y5-survivalROC(Stime=test$time,status=test$status,marker=riskscore,predict.time=5,span = 0.25*(nrow(train)(-0.20)a-matri*(data=c(y1
15、,y3,y5,y1$AUC,y3$AUC,y5$AUC),nrow=3,ncol=2);aplot(y1$FP,y1$TP,type=l,*lab=False Positive Rate,ylab = True Positive Rate,main=Time-dependent ROC curve,col=green) lines(y3$FP,y3$TP,col=red,lty=2)lines(y5$FP,y5$TP,col=blue,lty=3)legend(bottomright,bty=n,legend = c(AUC at 1 year:0.8761,AUC at 3 years:0.
16、7611,AUC at 5 years:0.7611),col=c(green,red,blue),lty=c(1,2,3),ce*=0.9)abline(0,1)a-matri*(0,30,3)for (c in 1:30) i-sample(1:77,52) train-datai, test-data-i, mod.brea-co*ph(Surv(time,status).,data=train) train_data-train,c(1,2,which(summary(mod.brea)$coefficients,5=0.1)+2) tset_data-test,c(1,2,which
17、(summary(mod.brea)$coefficients,5=0.1)+2) mod.brea1-co*ph(Surv(time,status).,data=train_data) names(coef(mod.brea1) inde*0-numeric(length(coef(mod.brea1) coefficients-coef(mod.brea1) name-gsub(,names(coefficients) for(j in 1:length(inde*0) inde*0j-which(names(dat)=namej) riskscore-as.matri*(dat-i,inde*0)%*% as.matri*(coefficients) y1-survivalROC(Stime=test$time,status=test$status,marker=riskscore,predict.time=1,span = 0.25*
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 確定年度目標的關鍵步驟計劃
- 養殖生產合同樣本
- 數字藝術在學校教育中的創新應用計劃
- 公路代建合同標準文本
- 人瑞合同樣本
- 凍品進口合同樣本
- 二建項目管理合同樣本
- 關于土建合同樣本
- 農場餐具租賃合同樣本
- 俄羅斯再生能源合同樣本
- 腰椎間盤突出癥試講教案
- 2024-2025年人教版七下語文期中復習-專題01 基礎知識積累(考點串講)
- 2025重慶西南證券股份有限公司招聘45人筆試參考題庫附帶答案詳解
- 2025-2030中國汽車用鋁板行業市場現狀供需分析及重點企業投資評估規劃分析研究報告
- 譯林版六年級英語下冊期中試卷及答案【真題】
- 湖南省示范性高中2024-2025學年高二下學期2月聯考 物理試卷(含解析)
- 2025年《宏觀經濟政策與發展規劃》考前通關必練題庫(含答案)
- 2024-2024年上海市高考英語試題及答案
- 2023版小學數學課程標準
- 2024-2025年全國初中化學競賽試卷及答案
- 幼兒園繪本故事:《神奇雨傘店》 課件
評論
0/150
提交評論