cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
vince_faller
Super User (Alumni)

Is there an easy way to script the Fit Model Macros?

I can't believe I've never asked this before, but does anyone know if I can give a script just what macro to run on what I have selected?  

 

Like say I want to do response surface on "Age" and "weight"

 

Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");

dt << Clear Column Selection();
dt << Select Columns({"weight", "age"});

fm = dt << Fit Model(Y(:height), 
	// do something involving Response Surface
);

// So that the final report looks the same as.

fm_real = dt << Fit Model(
	Y( :height ),
	Effects( :age, :weight & RS, :age * :weight, :weight * :weight ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
	Run()
);

I built a bunch of helper functions to do this previously and I really don't want to have to build them again.  

 

Vince Faller - Predictum
2 ACCEPTED SOLUTIONS

Accepted Solutions
peng_liu
Staff

Re: Is there an easy way to script the Fit Model Macros?

Try this:

Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dialog = dt << Fit Model(
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
);
dialog << Y( :height );
dialog << Effects(Response Surface(:weight, :age));
dialog << Run();

 

View solution in original post

peng_liu
Staff

Re: Is there an easy way to script the Fit Model Macros?

I have added its OSI documentation to JMP17. You should be able to find it under OSI > Objects > Fit Model > Model Dialog > Item Messages > Effects.

For FactorialToDegree and also PolynomialToDegree, what you did is not what you think it is. The arguments in side of the Macro names are interpreted as columns. So in your example, the number 2 is interpreted as the second column, which is :age. And FactorialToDegree and PolynomialToDegree will refer to the value in the Degree number edit box as the value for degree.

In JMP 16 and previous versions, you may have to go through display box scripting to change that. E.g.

Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dialog = dt << Fit Model(
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),	
);
report(dialog)[NumberEditBox(1)] << set (3);
dialog << Effects(FactorialtoDegree(:height, :weight, :age));

I made small improvement in JMP17. You will see it in the Effects OSI item when you have JMP17.

View solution in original post

5 REPLIES 5
peng_liu
Staff

Re: Is there an easy way to script the Fit Model Macros?

Try this:

Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dialog = dt << Fit Model(
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
);
dialog << Y( :height );
dialog << Effects(Response Surface(:weight, :age));
dialog << Run();

 

vince_faller
Super User (Alumni)

Re: Is there an easy way to script the Fit Model Macros?

Amazing. Is there any documentation on this?  It's not in the scripting guide or index.  Can I do factorial to degree X? 

 

*Edit* I figured it out.  Seems like it's just the exact wording of the macro. 

 

Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dialog = dt << Fit Model(
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),	
);
dialog << Y( :height );
dialog << Effects(FactorialtoDegree(2, :weight, :age));

 

@ben_ph this might be useful to you too.   

Vince Faller - Predictum
peng_liu
Staff

Re: Is there an easy way to script the Fit Model Macros?

I have added its OSI documentation to JMP17. You should be able to find it under OSI > Objects > Fit Model > Model Dialog > Item Messages > Effects.

For FactorialToDegree and also PolynomialToDegree, what you did is not what you think it is. The arguments in side of the Macro names are interpreted as columns. So in your example, the number 2 is interpreted as the second column, which is :age. And FactorialToDegree and PolynomialToDegree will refer to the value in the Degree number edit box as the value for degree.

In JMP 16 and previous versions, you may have to go through display box scripting to change that. E.g.

Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dialog = dt << Fit Model(
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),	
);
report(dialog)[NumberEditBox(1)] << set (3);
dialog << Effects(FactorialtoDegree(:height, :weight, :age));

I made small improvement in JMP17. You will see it in the Effects OSI item when you have JMP17.

StarfruitBob
Level VI

Re: Is there an easy way to script the Fit Model Macros?

@peng_liu, are these commands new in JMP 17? I have the exact same question as Vince, but they don't seem to work in JMP 16.

  • Response Surface()
  • FactorialtoDegree()
Learning every day!
peng_liu
Staff

Re: Is there an easy way to script the Fit Model Macros?

These? They are in 17.

 

peng_liu_0-1673487998384.png

 

peng_liu_1-1673488032611.png