User Input List for Regression Report with InteractionsI have an input box where users can select columns to be run in a regression report. This part works great. I then insert the list of columns into a list. I would like to take the list of columns and make different interactions that can be inserted into a regression report. Specifically, I am interested in slightly more complicated interactions (i.e. Column 1 * Column 2 ^2) When I try to put anything but just the generic list in the regression report, it doesn’t run the report. What do I do to create these interactions in the report?
The user input list readout looks like this: {"Column 1", "Column 2", "Column 3"}
platform = dt << Fit Model(
Y( :Char(variable)),
Effects(
What should go here?????
),
Personality( "Generalized Regression" ),
Generalized Distribution( "Normal" ),
Run(
Fit( Estimation Method( Two Stage Forward Selection ), Validation Method( AICc ), Enforce Heredity )
)
);
DOEScriptingRe: User Input List for Regression Report with InteractionsHere is one way to handle this
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: User Input List for Regression Report with InteractionsThe Scripting Index has an example for Effects - copied in below.
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: User Input List for Regression Report with InteractionsHere is another way using expressions. There are more solutions based on expressions than just this example.
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 )
)
);