How to display fit group with fit model objects?Hi JMP Community,
I am trying to generate a fit group model report across a list of response variables, which may or may not be present in the data. When I execute this in the GUI, JMP automatically drops any response variables that are not present. However, I need to do this in a script, and when I do Fit Group for all possible Fit Models, it displays Model Specifications for each missing response variable.
I tried to then fit models for existing variables in a loop, add them to a list, and then display in a Fit Group window (see script below). However, the Fit Model objects do not show in the Fit Group window whether I use Invisible or not. Weirdly, I can show the profilers across responses in the Fit Group window.
I would appreciate any advice on what I might be missing!
Thanks!,
Joff
responseVars = {"Logit[%TFRC+]", "Logit[Confluency]", "Log[Cell Count]"};
fitList = {};
// Loop over the response variables to create individual fits
For( i = 1, i <= N Items( responseVars ), i++,
If( Contains(dt << Get Column Names( "String" ), responseVars[i]),
fit = Fit Model(
Y( Column( responseVars[i] ) ),
Effects( gRNA ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Screening" ),
Run (1),
Invisible // Prevent the window from showing
);
// Add the fit object to the list
Insert Into( fitList, fit );
);
);
// Create the Fit Group using the list of fits
fitGroup = Fit Group( fitList );
Automation and ScriptingRe: How to display fit group with fit model objects?Hi @JoffJones,
I tested this on the Tablet Production sample data since i don't have your data example, but it looks like its because you aren't referring to 'gRNA' as a column, where it should be ":gRNA" including the ":". See example script below with the Tablet data that I tried.
dt=current data table();
responseVars = {"Dissolution", "Logit[Confluency]", "Log[Cell Count]"};
fitList = {};
// Loop over the response variables to create individual fits
For( i = 1, i <= N Items( responseVars ), i++,
If( Contains(dt << Get Column Names( "String" ), responseVars[i]),
fit = Fit Model(
Y( Column( responseVars[i] ) ),
Effects( :Atomizer Pressure ), //<<<<<THIS bit="" here="" doesnt="" work="" when="" its="" effects=""></THIS>Re: How to display fit group with fit model objects?I think you can wrap your loop with Fit Group()
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cols = {"NPN1", "IVP1", "PNP2"};
fg = Fit Group(
For Each({colname}, cols,
fit = dt << Fit Model(
Y(Eval(colname)),
Effects(:SITE),
Personality("Standard Least Squares"),
Emphasis("Effect Screening"),
Run (1)
);
);
);Re: How to display fit group with fit model objects?Thank you @jthi! This is a nice solution. Do you know how I can add the Profiler and Contour Profiler across the Fit Group? My initial tries have not succeeded.
Re: How to display fit group with fit model objects?This is a bit forced solution, but adding more models to Fit Group isn't documented and that is why I opted for this. Build list of model expressions, substitute the list fit Fit Group and evaluate that
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cols = {"NPN1", "IVP1", "PNP2"};
fits = {};
For Each({colname}, cols,
fit_expr = EvalExpr(
dt << Fit Model(
Y(Expr(NameExpr(AsColumn(dt, colname)))),
Effects(:SITE),
Personality("Standard Least Squares"),
Emphasis("Effect Screening"),
Run(1)
);
);
Insert Into(fits, Name Expr(fit_expr));
);
fg = Eval(Substitute(fits, Expr(List), Expr(Fit Group)));
fg << Profiler(1);
fg << Contour Profiler(1);