Re: ¿Cómo devolver AUC para una columna como un valor único (no un gráfico)?Aquí hay un ejemplo simple para hacer lo que está tratando de hacer.
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;
);
Re: ¿Cómo devolver AUC para una columna como un valor único (no un gráfico)?¡Perfecto!
¡Muchas gracias!
Bagazo
Re: ¿Cómo devolver AUC para una columna como un valor único (no un gráfico)?Mi primera pregunta es, ¿entiendes cómo funciona el script que proporcioné? El ejemplo simple no se proporcionó bajo el supuesto de que funciona con los datos reales. La línea clave es
dtOutput:AUC = (Report( theLog )["Receiver Operating Characteristic"][Number Col Box( 1 )] << get)[1];
Supongo que hay algo diferente en la forma en que JMP muestra las columnas que funcionan con esta línea de código frente a las que no. Le sugiero que mire manualmente las diferencias, y luego descubra qué es diferente y luego adapte el código para manejar ambos casos. Y puede haber más de dos casos con los que tendrá que lidiar.
¿Cómo devolver AUC para una columna como un valor único (no un gráfico)?Puedo usar lo siguiente para generar una curva ROC que contiene el valor AUC.
Nombres predeterminados hasta aquí (1); Abierto ("RESULTADOS.jmp"); Logística (Y (: IsDef), X (: Interés), Nivel Positivo (0), Curva ROC);
Esto genera una curva gráfica. Tengo una tabla con 80 columnas y quiero calcular el valor de AUC para cada columna y simplemente devolver cada una como un valor numérico. No quiero generar la representación gráfica. ¿Hay alguna fórmula que pueda usarse dentro de la hoja en sí?
Muchas gracias de antemano por cualquier ayuda!
Bagazo
Re: ¿Cómo devolver AUC para una columna como un valor único (no un gráfico)?¡Gracias! Parece una excelente solución, pero solo procesa 23 de 75
valores. El script se ejecuta completa y exitosamente sin errores de depuración,
sin embargo, no puede procesar columnas numéricas que pueden procesarse manualmente.
¿Alguna idea de por qué?
Aquí está el script que se está ejecutando:
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;
);
Muchas gracias por la ayuda!
Mejor,
Bagazo