Elenco input utente per report di regressione con interazioniHo una casella di input in cui gli utenti possono selezionare le colonne da eseguire in un report di regressione. Questa parte funziona alla grande. Quindi inserisco l'elenco delle colonne in un elenco. Vorrei prendere l'elenco delle colonne e creare diverse interazioni che possono essere inserite in un rapporto di regressione. In particolare, sono interessato a interazioni leggermente più complicate (es. Colonna 1 * Colonna 2 ^2) Quando provo a inserire qualsiasi cosa tranne l'elenco generico nel report di regressione, non esegue il report. Cosa devo fare per creare queste interazioni nel report?
La lettura dell'elenco di input dell'utente ha il seguente aspetto: {"Colonna 1", "Colonna 2", "Colonna 3"}
piattaforma = dt << Adatta modello (
Y( :Car (variabile)),
Effetti(
Cosa dovrebbe andare qui????
),
Personalità ("Regressione generalizzata"),
Distribuzione generalizzata ("Normale"),
Correre(
Fit (metodo di stima (selezione anticipata in due fasi), metodo di convalida (AICc), applicazione dell'ereditarietà)
)
);
dainaScriptingRe: Elenco input utente per report di regressione con interazioniLo Scripting Index ha un esempio per gli effetti - copiato di seguito.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Dogs.jmp" );
obj = Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
Effects( :drug, :dep1, :drug * :dep1 ),
Personality( Manova ),
Run( Response Function( Sum ) )
);
Re: Elenco input utente per report di regressione con interazioniEcco un modo per gestirlo
names default to here(1);
dt=data table("big class");
variable = "Age";
// If you build your list as expressions the code below works
effectsList = {height, weight, weight * height};
Fit Model(
Y( :char(variable) ),
Effects( eval(effectsList) ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:char(variable) << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 )}
)
);
/*
// If you build your list using strings
effectsList = {"height", "weight", "weight * height"};
// You can convert the elements back to expressions by
// using the Parse() function
For( i = 1, i <= N Items( effectsList ), i++,
effectsList[i] = Parse( effectsList[i] );
);Re: Elenco input utente per report di regressione con interazioniEcco un altro modo di usare le espressioni. Esistono più soluzioni basate su espressioni oltre a questo esempio.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Dogs.jmp" );
predictor = { :drug, :dep1 };
n = N Items( predictor );
effectExpr = Expr( Effects() );
For( x1 = 1, x1 < n, x1++,
Insert Into( effectExpr, predictor[x1] );
For( x2 = 2, x2 <= n, x2++,
Eval(
Substitute(
Expr( Insert Into( effectExpr, Expr( xxx1 * xxx2 ) ) ),
Expr( xxx1 ), predictor[x1],
Expr( xxx2 ), predictor[x2]
)
)
);
);
Show( Name Expr( effectExpr) );
Eval(
Substitute(
Expr(
obj = dt << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
eee,
Personality( Manova ),
Run( Response Function( Sum ) )
);
),
Expr( eee ), Name Expr( effectExpr )
)
);