turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Variable Fit Model Scripting possible?

Topic Options

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

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

Mar 11, 2012 5:47 PM
(1056 views)

Hi everyone, i'm new to this forum and hope to get along with you all:) I'm a student using JMP but am facing some difficulties in scripting pertaining to the fit model part. The following illustrates the fit model code which i can't seem to get it working:

a=0;

var_list={:param1,:param2};

rs_list={

:test1,:};test2,:test3,:test4,:test5obj=Fit Model(

Y(var_list[1]),

Effects(

response surface(:test1,:),test2,:test3,:test4,:test5)Personality( Standard Least Squares ),

Emphasis( Effect Screening ),

Run()

);

if(a==1,

obj<<Profiler(1, Confidence Intervals( 1 ),Desirability Functions( 1 ),

var_list[1]<<Response Limits( {Goal( Maximize ), Importance( 1 )} ),

maximize desirability(1),

);

obj << {Lack of Fit( 0 ), Sorted Estimates( 1 ),

Plot Actual by Predicted( 1 ), Plot Regression( 0 ),

Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )};

);

if(a==0,

obj<<Profiler(1, Confidence Intervals( 1 ),Desirability Functions( 1 ),

var_list[1]<<Response Limits( {Goal( Minimize), Importance( 1 )} ),

maximize desirability(1),

);

obj << {Lack of Fit( 0 ), Sorted Estimates( 1 ),

Plot Actual by Predicted( 1 ), Plot Regression( 0 ),

Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 )};

);

i have 10 variables in a list and would like to use them all to go through a series of least square analysis via fitmodelling but i can't seem to get it to work. the code above was initially planned to be inserted into a *for loop to loop 10 times (this might vary as the number of variables might be more or less) but the thing is i would like to use a loop to command jmp to perform the desired analysis from the list above...also, is it possible to place rs_list into the response surface function above? (i can't seem to get the list to work too)...any ideas or advice is greatly appreciated! thanx in advance and have a nice day ahead!:)*

1 ACCEPTED SOLUTION

Accepted Solutions

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

Solution

Ok, my code works here when applied to to the example table I used. When aplied to a larger table I also experience that the actual by predicted plot was missing for some iterations. I guess that it may result from slow fitting of the desirabilities and that JMP keeps executing code ahead despite the current calculations are not finished. Sometimes this can be solved by inserting Wait() commands at the right places (not obvious here where those can be).

7 REPLIES

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

Mar 12, 2012 8:14 AM
(796 views)

This may be helpful:

var_list={:DrvrOS,:DrvrUS};

rs_list={:SKEW,:PKGIMP,:MBIMP,:XT,:MBLEN};

fm = Fit Model(

Y(eval(var_list)),

Effects( eval(rs_list)),

Personality( Standard Least Squares ),

Emphasis( Effect Screening ),

Run()

);

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

Mar 12, 2012 12:44 PM
(796 views)

As noted above by mpb, Y() and Effects() understand variables and evaluated lists of variables. However, the Profiler message "<< Response limits({})" appears not to evaluate a column variable, at least not represented by a list item. To loop this over a variable list is therefore not very straightforward.

One way to get around that is to use expressions and substitute the critical entries within the loop.

Here's an example (using one of JMPs sample data files):

dt = Open**(** "$ENGLISH_SAMPLE_DATA/Tiretread.jmp" **)**;

a = **0**;

goal_list = **{**Minimize, Maximize**}**; // options list

var_list = **{**:ABRASION, :HARDNESS**}**;

rs_list = **{**:SILICA, :SILANE, :SULFUR**}**;

objsettings_expr = Expr**(**

obj << Profiler**(**

**1**,

Confidence Intervals**(** **1** **)**,

var << Response Limits**(** **{**Goal**(** maxmin **)**, Importance**(** **1** **)}** **)**,

maximize desirability**(** **1** **)**,

Desirability Functions**(** **1** **)**

**)**

**)**;

Substitute Into**(** objsettings_expr, Expr**(** maxmin **)**, goal_list**[**a + **1****]** **)**; // set goal

For**(** i = **1**, i <= N Items**(** var_list **)**, i++,

obj = dt << Fit Model**(**

Y**(** var_list**[**i**]** **)**,

Effects**(** Eval**(** rs_list **)** **)**,

Personality**(** Standard Least Squares **)**,

Emphasis**(** Effect Screening **)**,

Lack of Fit**(** **0** **)**,

Sorted Estimates**(** **1** **)**,

Plot Actual by Predicted**(** **1** **)**,

Plot Regression**(** **0** **)**,

Plot Residual by Predicted**(** **0** **)**,

Plot Effect Leverage**(** **0** **)**,

Run**()**

**)**;

Eval**(** Substitute**(** Name Expr**(** objsettings_expr **)**, Expr**(** var **)**, var_list**[**i**]** **)** **)**;// apply profiler settings

**)**;

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

Mar 12, 2012 5:44 PM
(796 views)

First of all, thank you mpb and ms for the advice, i truly appreciate your help! Firstly, refering to mpb's reply, i need to use the** response surface()** for my analysis and it seems like doing this:

response surface(eval(rs_list))

does not work.i've tried the method suggested by mpb previously for many times but to no avail. The following code was used:

Cannot find specified column in access or evaluation of 'Eval' , Eval( rs_list )

In the following script, error marked by /*###*/

obj=Fit Model(

Y( var_list

), //this part works perfectly fine if the response list is listed out belowEffects( response surface( Eval/*###*/(rs_list) ) ),

Personality( Standard Least Squares ),

Emphasis( Effect Screening ),

Run,

invisible

);

Any way to implement response surface or other alternative methods?

As for MS' reply, i was wondering, can you read my mind hahaha...yeah, the main problem i'm facing is the response limit part! it doesn't seem to maximize or minimize corrrectly as needed...i'll try out your example above:)... but thank you,so much for your help, i sincerely appreciate all this help as i have been trying this for weeks:)

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

Mar 12, 2012 11:56 PM
(796 views)

Sorry, I missed the respons surface part. And as you've also experienced is another function that not seem to resolve lists well. JSL is quite annoying in this respect as there is often difficult to tell beforehand the requirements for the argument.

So we have to do the same trick also fr the Fit Model obj, ie use an expression and substitute. For example:

dt = Open**(** "$ENGLISH_SAMPLE_DATA/Tiretread.jmp" **)**;

a = **0**;

goal_list = **{**Minimize, Maximize**}**; // options list

var_list = **{**:ABRASION, :HARDNESS**}**;

rs_list = **{**:SILICA, :SILANE, :SULFUR**}**;

obj_expr=expr**(**obj = dt << Fit Model**(**

Y**(** var_list**[**i**]** **)**,

Effects,

Personality**(** Standard Least Squares **)**,

Emphasis**(** Effect Screening **)**,

Lack of Fit**(** **0** **)**,

Sorted Estimates**(** **1** **)**,

Plot Actual by Predicted**(** **1** **)**,

Plot Regression**(** **0** **)**,

Plot Residual by Predicted**(** **0** **)**,

Plot Effect Leverage**(** **0** **)**,

Run**()**

**))**;

objsettings_expr = Expr**(**

obj << Profiler**(**

**1**,

Confidence Intervals**(** **1** **)**,

var << Response Limits**(** **{**Goal**(** maxmin **)**, Importance**(** **1** **)}** **)**,

maximize desirability**(** **1** **)**,

Desirability Functions**(** **1** **)**

**)**

**)**;

rs_cols = Regex**(** Char**(** rs_list **)**, "\{(.+)\}", "\1" **)**; // Strip list from curly brackets

Substitute Into**(** obj_expr, Expr**(** Effects **)**, Parse**(** "Effects( response surface(" || rs_cols || "))" **)** **)**; // insert the Effects as a Parse(string)

Substitute Into**(** objsettings_expr, Expr**(** maxmin **)**, goal_list**[**a + **1****]** **)**; // set goal

For**(** i = **1**, i <= N Items**(** var_list **)**, i++,

obj_expr;

Eval**(** Substitute**(** Name Expr**(** objsettings_expr **)**, Expr**(** var **)**, var_list**[**i**]** **)** **)**;// apply profiler settings

**)**;

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

Mar 13, 2012 12:37 AM
(796 views)

MS, i've tried your code, it seems like i'm looking at some bugs?...what i'm seeing is that sometimes the actual plot does not appear in the prediction windowin in reports while the others have them eg: drvros' report does not have the actual plot whereas the drvrus plot has the actual plot...i also tried to maximize and minimize according to a sequence, eg maximize first, then minimize but it does seem to work as well...any ideas? thanx in advance!:)

PS: Thank you so much for your expert guidance, i've learnt so much from your two replies, JSL can really get on one's nerves haha, previously, i couldn't find the response surface() function in the scripting guide(it's not listed in JMP9.0.3 scripting guide) and used other methods like:

effects(

var1 & RS,

var2 & RS,

polynomial (var1,var2),

factorial(var1,var2),

)

which can be simplified using the response surface(var1,var2) function...i just decided to give it a try and it works LOL...

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

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

Mar 14, 2012 5:56 PM
(796 views)