Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Feb 6, 2018 6:10 AM
| Last Modified: Feb 6, 2018 2:51 PM
(4156 views)

I am trying to pars effects to a fit model in a script.

The effects are generated by a script using several runs of stepwise selection using nominal logistic regression. The selected variable names are outputted to a JMP datafile "final selection.jmp".

This is no problem if only main effects are selected, but I have not been successful in including a two factor interaction.

For main effects only I used the following script:

```
Basedata=concat( projectpath, "final selection.jmp");
dt = OPEN(basedata);
myparameters = :Parameter << Get Values();
close(dt,nosave);
sdt = Open(concat(projectpath, "all data.jmp"));
UseEffects = {};
For (ii = 1, ii <= NItems(myparameters), ii++,
colname = myparameters[ii];
col = Column(sdt, colname);
InsertInto(UseEffects, col)
);
Fit Model(
Y( :Y ),
Effects( Eval(UseEffects)),
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ), Confusion Matrix( 1 ) )
);
```

Using the same script if an interaction is selected results in an error message "could not find column ..."

I then tried the following script to generate an array with effects:

```
For (ii = 1, ii <= NItems(myparameters), ii++,
colname = myparameters[ii];
position = contains(colname,"*");
If (position > 0,
col = ":"||left(colname,position)||" :"||right(colname,length(colname)-position),
col = ":"||colname);
/*col = Column(sdt, colname);*/
InsertInto(UseEffects, col)
);
```

Although the effect names in UseEffects look ok, this also fails and gives again a "Column not found ... " error.

Any solution is welcome.

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I think you might need to use JSL expressions for this. Below is an example similar to yours using the Boston Housing sample data table:

```
myparameters = {"crim*zn", "zn", "indus", "nox", "rooms", "age", "distance"};
sdt = Open("$SAMPLE_DATA/Boston Housing.jmp");
EffectsExpr = Expr(Effects());
For (ii = 1, ii <= NItems(myparameters), ii++,
colname = myparameters[ii];
position = contains(colname,"*");
If (position > 0,
col = ":"||left(colname,position)||" :"||right(colname,length(colname)-position),
col = ":"||colname
);
/*col = Column(sdt, colname);*/
InsertInto(EffectsExpr, parse(col))
);
fmExpr = substitute(
Expr(Fit Model(
Y( :chas ),
_effects_,
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ), Confusion Matrix( 1 ) )
)),
expr(_effects_),
nameexpr(EffectsExpr)
);
eval(fmExpr)
```

Michael Crotty

Sr Statistical Writer

JMP Development

Sr Statistical Writer

JMP Development

2 REPLIES 2

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I think you might need to use JSL expressions for this. Below is an example similar to yours using the Boston Housing sample data table:

```
myparameters = {"crim*zn", "zn", "indus", "nox", "rooms", "age", "distance"};
sdt = Open("$SAMPLE_DATA/Boston Housing.jmp");
EffectsExpr = Expr(Effects());
For (ii = 1, ii <= NItems(myparameters), ii++,
colname = myparameters[ii];
position = contains(colname,"*");
If (position > 0,
col = ":"||left(colname,position)||" :"||right(colname,length(colname)-position),
col = ":"||colname
);
/*col = Column(sdt, colname);*/
InsertInto(EffectsExpr, parse(col))
);
fmExpr = substitute(
Expr(Fit Model(
Y( :chas ),
_effects_,
Personality( "Nominal Logistic" ),
Run( Likelihood Ratio Tests( 1 ), Wald Tests( 0 ), Confusion Matrix( 1 ) )
)),
expr(_effects_),
nameexpr(EffectsExpr)
);
eval(fmExpr)
```

Michael Crotty

Sr Statistical Writer

JMP Development

Sr Statistical Writer

JMP Development

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: How can I parse effects to "Fit Model" in a script?

Thank you, I have used the solution you described and it did solve my problem.

Article Labels

There are no labels assigned to this post.