如何將列的 AUC 作為單一值(而不是圖表)傳回?我可以使用以下命令產生包含 AUC 值的 ROC 曲線。
Names Default To Here( 1 );
Open( "RESULTS.jmp" );
Logistic( Y( :IsDef ), X( :Interest ), Positive Level( 0 ), ROC Curve );
這會產生一條圖形曲線。 我有一個包含 80 列的表,我想計算每列的 AUC 值,並簡單地將每個列作為數值傳回。 我不想產生圖形表示。 是否有可以在工作表本身中使用的公式?
非常感謝您的幫忙!
馬克
回覆:如何將列的 AUC 作為單一值(而不是圖表)傳回?我的第一個問題是,你明白我提供的腳本是如何運作的嗎?這個簡單的例子並不是假設它可以與真實數據一起工作的情況下提供的。關鍵行是
dtOutput:AUC = (Report( theLog )["Receiver Operating Characteristic"][Number Col Box( 1 )] << get)[1];
我認為 JMP 顯示適用於該程式碼行的列與不適用該行程式碼的列的方式有所不同。我建議您手動查看差異,然後找出不同之處,然後調整程式碼來處理這兩種情況。您可能需要處理兩種以上的情況。
回覆:如何將列的 AUC 作為單一值(而不是圖表)傳回?完美的!
非常感謝!
馬克
回覆:如何將列的 AUC 作為單一值(而不是圖表)傳回?謝謝! 這似乎是一個很好的解決方案,但它只處理 75 個中的 23 個
價值觀。 該腳本完全成功運行,沒有調試錯誤,
但無法處理可以手動處理的數字列。
知道為什麼嗎?
這是正在運行的腳本:
Names Default To Here( 1 );
// Open and example data table
dt = Open( "RESULTS3.jmp" );
// Get the columns to be analyzed
colNamesList = dt << get column names( string, continuous );
// Create a data table to save the results to
dtOutput = New Table( "AUCResults", New Column( "Column", character ), New Column( "AUC" ) );
// Loop across all of the columns to be analyzed and retrieve the AUC
For( i = 1, i <= N Items( colNamesList ), i++,
// Add a new row to the output data table
dtOutput << Add Rows( 1 );
// Add the active variable name to the current row in the data table
dtOutput:Column[i] = colNamesList[i];
// Run the Logistic Regression
theLog = dt << Logistic( invisible, Y( :isDef ), X( Column( colNamesList[i] ) ), Positive Level( "0" ), ROC Curve );
// Add the AUC to the data table by grabbing it from the display report output
dtOutput:AUC = (Report( theLog )["Receiver Operating Characteristic"][Number Col Box( 1 )] << get)[1];
// Close the report window
Report( theLog ) << close window;
);
非常感謝您的幫忙!
最好的,
馬克
回覆:如何將列的 AUC 作為單一值(而不是圖表)傳回?這是一個簡單的例子來完成您想要做的事情
Names Default To Here( 1 );
// Open and example data table
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Get the columns to be analyzed
colNamesList = dt << get column names( string, continuous );
// Create a data table to save the results to
dtOutput = New Table( "Results", New Column( "Column", character ), New Column( "AUC" ) );
// Loop across all of the columns to be analyzed and retrieve the AUC
For( i = 1, i <= N Items( colNamesList ), i++,
// Add a new row to the output data table
dtOutput << Add Rows( 1 );
// Add the active variable name to the current row in the data table
dtOutput:Column[i] = colNamesList[i];
// Run the Logistic Regression
theLog = dt << Logistic( invisible, Y( :sex ), X( Column( colNamesList[i] ) ), Positive Level( "F" ), ROC Curve );
// Add the AUC to the data table by grabbing it from the display report output
dtOutput:AUC = (Report( theLog )["Receiver Operating Characteristic"][Number Col Box( 1 )] << get)[1];
// Close the report window
Report( theLog ) << close window;
);