JMP 18.1.2 Estrarre i valori RSquare dall'analisi di adattamento Y per XEsecuzione di Analyze > Fit Y by X. Ho il codice qui sotto che apre una tabella dati ma non ci sono valori RSquare nella tabella. Avete qualche idea su cosa mi sfugge?
// Open Data Table
dt = Data Table( "Raw Data" );
// Run Fit Y by X Analysis with a By Variable
fitObj = dt << Fit Y by X( Y( :"Mean(VALUEABS)" ), X( :Mean ), By( :PARM_LABEL ) );
// Get the analysis report
rpt = fitObj << Get Report;
// Find all RSquare nodes in the report
rsquareNodes = rpt << Find All Matching Elements( "RSquare" );
Show( "Number of RSquare nodes found: " || Char( N Items( rsquareNodes ) ) );
// Initialize a list to store the by group and RSquare pairs
rsquareData = {};
// Loop over each RSquare node found
For( i = 1, i <= N Items( rsquareNodes ), i++,
{
// Extract the RSquare text and convert to numeric value
rsqText = rsquareNodes[i] << Get Text ; rsqVal = Num( rsqText ) ;
// Try to retrieve the by-group label.
parentObj = rsquareNodes[i] << Get Parent ; byLabel = "" ;
While( byLabel == "" & parentObj != {},
byLabel = parentObj << Get Text;
If( byLabel == "",
parentObj = parentObj << Get Parent
);
) ;
// Append the pair (by group label, RSquare value) to list.
Append( rsquareData, {byLabel, rsqVal} ) ; }
);
Show( rsquareData );
// Create a new data table to store the RSquare values by by-group.
rsqDT = New Table( "RSquare Values",
Add Columns(
Column( "By Group", Character, "Nominal" ),
Column( "RSquare", Numeric, "Continuous" )
)
);
// Populate the new data table with the extracted values
For( i = 1, i <= N Items( rsquareData ), i++,
{New Row( rsqDT ) ; rsqDT:("By Group")[Row()] = rsquareData[i][1] ; rsqDT:RSquare[
Row()] = rsquareData[i][2] ; }
);
// Display the new data table
Show( rsqDT );
(Sopra JSL è passato dalla visualizzazione del testo normale al formato di visualizzazione JMP JSL) txnelson
Automazione e scriptingRe: JMP 18.1.2 Estrarre i valori RSquare dall'analisi di adattamento Y per XQuale RSquare stai cercando? In genere dovresti farlo manualmente in JMP e poi prendere lo script che JMP crea per te (o usare workflow e ottenere lo script da quello). Quindi in questo caso:
1. Apri la tua tabella
2. Eseguire l'analisi

3. Apportare le modifiche al report/analisi secondo necessità (linea di adattamento)

4. Trasformare la tabella in una tabella dati

5. Ottieni lo script
// Open Data Table: Big Class.jmp
// → Data Table("Big Class")
Open("$SAMPLE_DATA/Big Class.jmp");
// Combine similar TableBoxes into a Data Table
// → Data Table("Untitled")
Local({obj},
obj = Data Table("Big Class") << Bivariate(
Y(:height),
X(:weight),
Fit Line({Line Color({230, 159, 0})}),
By(:age)
);
Report(obj[1])["Linear Fit", "Summary of Fit", Table Box(1)] <<
Make Combined Data Table;
obj[1] << Close Window;
);
Quindi puoi modificarlo per renderlo un po' migliore e finire con qualcosa come
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt << Bivariate(
Y(:height),
X(:weight),
Fit Line({Line Color({230, 159, 0})}),
By(:age)
);
dt_result = Report(biv[1])["Linear Fit", "Summary of Fit", Table Box(1)] << Make Combined Data Table;
dt_result << Select Where(:Column 1 != "RSquare") << delete rows << clear select;Re: JMP 18.1.2 Estrazione dei valori RSquare dall'analisi di adattamento Y per XC'erano diversi problemi con la tua sintassi. Di seguito un esempio di come affronterei il problema
// Open Data Table
dt = Data Table( "Raw Data" );
// Run Fit Y by X Analysis with a By Variable
fitObj = dt << Fit Y by X( Y( :"Mean(VALUEABS)" ), X( :Mean ), By( :PARM_LABEL ) );
dt=current data table();
fitObj = dt << Bivariate(
Y( :height ),
X( :weight ),
Fit Line( {Line Color( {212, 73, 88} )} ),
By( :sex )
);
nrpts = nitems(fitObj);
report(fitobj[1])[OutlineBox(1)] << get title
// Find all RSquare nodes in the report
Show( "Number of RSquare nodes found: " || Char( nrpts ) );
rsquareData = {};
// Initialize a list to store the by group and RSquare pairs
For Each( {obj}, fitObj,
r2=report(obj);
rsq = (r2["Linear Fit","Summary of Fit",numbercolbox(1)]<<GET></GET>Re: JMP 18.1.2 Estrarre i valori RSquare dall'analisi di adattamento Y per XIl codice iniziale sembra sicuramente generato dall'intelligenza artificiale, il che spiegherebbe i numerosi errori nella sintassi.
Re: JMP 18.1.2 Estrazione dei valori RSquare dall'analisi di adattamento Y per XGrazie per la risposta. Sto cercando il valore RSquare. Ho eseguito l'analisi Fit Y By X e ho preso il codice dal log. Poi ho aggiunto una linea di adattamento ma quell'azione non è stata registrata. È passato un po' di tempo e mi ero dimenticato della funzione clic destro e Make Into a Data Table. Quindi grazie per il ripasso.
Re: JMP 18.1.2 Estrarre i valori RSquare dall'analisi di adattamento Y per XJim, grazie per questa soluzione. La apprezzo molto.
Re: JMP 18.1.2 Estrarre i valori RSquare dall'analisi di adattamento Y per XHai proprio ragione! Come ho detto in precedenza, avendo dimenticato l'opzione Crea tabella dati con il tasto destro del mouse, ho fatto ricorso a ChatGPT.