I'm trying to create a model of nested items based on user selections where each item is nested in the item before it. But the effects for fit model have some odd characteristics and when I try to do it dynamically I usually get invalid matrix tokens. I'm able to do make it work with string parsing but that seems cludgey. Is there any functional way of calling a column nested (or crossed for that matter)?
Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
cols = {"sex", "age"}; //I want each column to be nested into everything before it<BR />cols = {"sex", "age", "name"}; // either
fm = Fit Model(
Y( :height ),
Effects( :age[:sex], :sex ), //how do I do this dynamically
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:height << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
Parameter Estimates( 1 ), Lack of Fit( 0 ), 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 )}
)
);
Here's a start. To generalize for handling any number (>2) of effect variables requires more work.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA\Big Class.jmp");
cols = {"sex", "age"};
//Model expr
fme = Expr(
fm = Fit Model(Y(:height), X, Run())
);
//Effects expr
e = Expr(Effects(a[b], b));
Substitute Into(e, Expr(a), cols[2], Expr(b), cols[1]);
// Edit and eval model expr
Substitute Into(fme, Expr(X), Name Expr(e));
fme;