Ri: Come restituire AUC per una colonna come valore singolo (non un grafico)?Ecco un semplice esempio per fare ciò che stai cercando di fare
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;
);
Ri: Come restituire AUC per una colonna come valore singolo (non un grafico)?Perfetto!
Grazie mille!
Marc
Ri: Come restituire AUC per una colonna come valore singolo (non un grafico)?La mia prima domanda è: capisci come funziona lo script che ho fornito? Il semplice esempio non è stato fornito supponendo che funzioni con i dati reali. La linea chiave è
dtOutput:AUC = (Report( theLog )["Receiver Operating Characteristic"][Number Col Box( 1 )] << get)[1];
Suppongo che ci sia qualcosa di diverso nel modo in cui JMP mostra le colonne che funzionano con questa riga di codice rispetto a quelle che non lo fanno. Ti suggerisco di esaminare manualmente le differenze, quindi capire cosa è diverso e quindi adattare il codice per gestire entrambi i casi. E ci possono essere più di due casi che dovrai affrontare.
Come restituire AUC per una colonna come valore singolo (non un grafico)?Posso usare quanto segue per generare una curva ROC che contiene il valore AUC.
Nomi predefiniti qui (1); Apri ("RESULTS.jmp"); Logistica (Y (: IsDef), X (: Interesse), Livello positivo (0), Curva ROC);
Questo genera una curva grafica. Ho una tabella con 80 colonne e voglio calcolare il valore AUC per ogni colonna e semplicemente restituire ciascuna come valore numerico. Non voglio generare la rappresentazione grafica. Esiste una formula che potrebbe essere utilizzata all'interno del foglio stesso?
Molte grazie in anticipo per qualsiasi assistenza!
Marc
Ri: Come restituire AUC per una colonna come valore singolo (non un grafico)?Grazie! Sembra una soluzione eccellente, ma elabora solo 23 su 75
valori. Lo script viene eseguito in modo completo e corretto senza errori di debug,
tuttavia non riesce a elaborare colonne numeriche che possono essere elaborate manualmente.
Qualche idea sul perché?
Ecco lo script come in esecuzione:
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;
);
Mille grazie per l'assistenza!
Migliore,
Marc