JSL - Salva la migliore trasformazioneCiao,
Sto eseguendo lo script qui sotto e si fermerà dopo la generazione della casella del contorno box-cox. Quello che faccio è quindi quello di 'Salva la migliore trasformazione' manualmente nella casella di dialogo 'Trasformazione di Cox Box'. La mia domanda: esiste un modo per automatizzare la "Salva migliore trasformazione" tramite JSL per continuare con lo script su più elementi da trasformare? grazie per l'aiuto
-Rgsd, Joel
Pulisci il registro();
dtName = "Big Class";
dt = Open ("$ SAMPLE_DATA /" || dtName || ".jmp");
nwd = Nuova finestra ("Box Cox",
dt << Fit Model (
Y (: peso),
effetti,
Personalità ("minimi quadrati standard"),
Enfasi ("Effetto leva"),
Correre(
: peso << {Riepilogo di adattamento (1), Analisi della varianza (1), Stima dei parametri (1), Mancanza di adattamento (0), Plot effettivo di previsione (1),
Plot Regression (0), Plot Residual by Predicted (1), Plot Effect Leverage (1), Box Cox Y Transformation (1),
salva la migliore trasformazione (1)}
)
)
);
Ri: JSL - Save Best TransformationCordiali saluti, ecco un'alternativa che non richiede di costruire una stringa. In questo modo, viene mantenuto il controllo della sintassi e l'evidenziazione nell'editor. Se fai tanti errori come me, è utile.
NamesDefaultToHere(1);
dtName = "Big Class";
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
numericCols = dt << getColumnNames("String", "Numeric");
// Build a function to do what's needed . . .
getBestBoxCox =
Function({numCol}, {Default Local},
// Open the fit model lauch dialog
fmDialog = dt << Fit Model(
Y( Eval(numCol) ),
Effects,
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" )
);
// Run the desired model ('fmAnalysis' is a reference to the analysis layer of the report window)
fmAnalysis = fmDialog << runModel;
// Close the launch dialog
Report(fmDialog) << closeWindow;
// Ask for the transformations
fmAnalysis << Box Cox Y Transformation;
// Get a reference to the little red triangle for the transformations
lrt = Report(fmAnalysis)["Box-Cox Transformations"] << getScriptableObject;
// Save the best transformation
lrt << saveBestTransformation;
// Close the report window
Report(fmAnalysis) << closeWindow;
);
// Use the function on the required columns . . .
for(c=1, c<=NItems(numericCols), c++, getBestBoxCox(numericCols[c]));
Ri: JSL - Save Best TransformationCiao stephen_pearson,
Proprio quello di cui ho bisogno 'Box Cox Y Transformation (1, Save Best Transformation (1))'. Sì, sto utilizzando diverse selezioni per questa opzione e la sua elaborazione è ora senza intervento manuale. GrazieRi: JSL - Save Best TransformationSe crei il codice che hai condiviso in JSL come una stringa e hai tutti i nomi di colonna che desideri trasformare come elenco ( colListYBoxCox ) quindi è possibile sostituire i nomi delle colonne e scorrere su tutte le colonne dell'elenco (esempio di seguito).
Ho fatto questo e poi ho controllato se la trasformazione box-cox faceva una grande differenza e cancellato automaticamente quelli che erano una perdita di tempo.
Saluti,
Stefano
Per (i = 1, i <= N Items (colListYBoxCox), i ++,
boxcoxstring = "boxcoxwindow = Fit Model (
Y ( ";
boxcoxstring = Concat (boxcoxstring, ": Name (\!" ", colListYBoxCox [i]," \! "),");
boxcoxstring = Concat (boxcoxstring, "),");
boxcoxstring = Concat (
boxcoxstring,
"Effetti,
Personalità (\! "Standard Least Squares \!"),
Enfasi (\! "Effect Leverage \!"), "
);
boxcoxstring = Concat (
boxcoxstring,
"Run (:! Nome (\"",
colListYBoxCox [i],
"\!") << {Mancanza di adattamento (0), Plot Actual by Predicted (0),
Plot Regression (0), Plot Residual by Predicted (0),
Plot Effect Leverage (0), Box Cox Y Transformation (1, Save Best Transformation (1)), Mostra VIF (1)},
),"
);
boxcoxstring = Concat (boxcoxstring, ");" );
Eval (Parse (boxcoxstring));
Attendi (0);
boxcoxwindow << Chiudi la finestra;
);