發表文章

目前顯示的是有「ROC」標籤的文章

使用SAS 9.2 繪製ROC曲線和比較

圖片
在2008年4月的時候,曾經寫過一篇 繪製ROC曲線和比較兩條ROC曲線下面積 的小文章,這篇是以MACRO來畫圖和比較,而在新版的SAS 9.2中已經可以於PROC LOGISTICS直接繪製高品質的ROC曲線(Receiver Operating Characteristic Curves, ROC Curves)。 在SAS 9.2中ODS GRAPHICS支援的程序增加許多,其中也包括PROC LOGISTICS。 先產生一筆虛擬的資料 data Age_data; input disease age bw@@; datalines; 0 50 65  0 39 61  0 21 70  0 61 67 0 30 55  0 35 63  0 25 52  0 41 66 0 43 52  0 36 54  0 37 46  0 25 61 0 41 53  0 62 55  0 28 70  0 33 68 1 52 45  1 49 61  1 47 42  1 62 31 1 55 67  1 70 61  1 75 55  1 77 52 1 81 68  1 64 53  1 62 41  1 39 57 1 61 51  1 61 55  1 57 49  1 79 67 ; run; 接下來就直接套用繪製的ROC曲線的語法 ods graphics on; proc logistic data=age_data plots(only)=(roc) rocoptions(id=prob) ; model disease (event='1')=age; run; ods graphics off; ods graphics on : 為宣告要繪製ods graphics的...

繪製ROC曲線和比較兩條ROC曲線下面積

圖片
SAS實用巨集簡介:繪製ROC曲線和比較兩條ROC曲線下面積 目的為介紹SAS官方網頁中關於ROC曲線的巨集(Macro)程式,程式分別為「繪製ROC曲線」和「以無母數方式比較兩條ROC曲線下面積」。本文中所提及之程式,僅為原作者的部分語法,詳細語法請見原文說明,兩篇原文出處連結如下: Sample 25017: Nonparametric comparison of areas under correlated ROC curves ( http://support.sas.com/kb/25/017.html )  roc.sas程式: http://support.sas.com/kb/25/addl/fusion_25017_6_roc.sas.txt Sample 25018: Plot ROC curve with labelled points for a binary-response model ( http://support.sas.com/kb/25/018.html )  rocplot.sas程式: http://support.sas.com/kb/25/addl/fusion25018_4_rocplot.sas.txt 請先將程式下載至本機硬碟中,建議將Sample 25017的程式取名為roc.sas,而Sample 25018的程式取名為rocplot.sas。必須要注意的是,如果是想比較兩條ROC曲線下面積,也就是roc.sas這個巨集程式,必須安裝SAS/IML。 繪製ROC曲線 在SAS說明檔中其實已經有介紹如何繪製出簡易的ROC曲線,但在我們諮詢的個案中比較常被問到的問題為,圖上的某個點其「原始數值為何」,利用rocplot.sas 便可輕鬆完成這個工作。 假設有一組資料,研究者想以年齡和某一個BW指標來判斷罹患某疾病的機會。 問題:繪製以年齡作為判斷此是否罹患此疾病的ROC曲線。 第一步: 先將資料讀入SAS中 data Age_data; input disease age bw@@; datalines; 0 50 65 0 39 61 0 21 70 0 61 67 0 30 55 0 35 63 0 25 72 0 41 66 0 43 52 0 36 54 0 37 76 0 25 61 0...