如何将列的 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;
);