cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
learning_JSL
Level IV

need to modify JSL code -- from a linear model fit to a polynomial curve model fit

Hi - I would like to modify my jsl code for regression fit from *linear* (i.e. LOG_ECOLI_Pear = 1.0571713 + 1.2673613*LOG_TURB_PEAR_FNU) to *polynomial degree 2*  (i.e. LOG_ECOLI_Pear = 1.0752636 + 1.2104736*LOG_TURB_PEAR_FNU + 0.3169796*(LOG_TURB_PEAR_FNU-1.27247)^2).    The jsl code I used for the linear fit is:

 

obj = Fit Model(
    Y( :LOG_ECOLI_PEAR ),
    Effects( :LOG_TURB_PEAR_FNU ),
    Personality( "Standard Least Squares" ),
    Emphasis( "Effect Leverage" ),
    Run( :LOG_ECOLI_PEAR )
);
obj << Prediction Formula;

 

What jsl code should I use for the polynomial fit?   Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Vvvv
Level II

Re: need to modify JSL code -- from a linear model fit to a polynomial curve model fit

Add the qudratic term in effects.

 

obj = Fit Model(
Y( :LOG_ECOLI_PEAR ),
Effects( :LOG_TURB_PEAR_FNU, :LOG_TURB_PEAR_FNU * :LOG_TURB_PEAR_FNU),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(:LOG_ECOLI_PEAR )) ;
obj << Prediction Formula;

V

View solution in original post

4 REPLIES 4
Vvvv
Level II

Re: need to modify JSL code -- from a linear model fit to a polynomial curve model fit

Add the qudratic term in effects.

 

obj = Fit Model(
Y( :LOG_ECOLI_PEAR ),
Effects( :LOG_TURB_PEAR_FNU, :LOG_TURB_PEAR_FNU * :LOG_TURB_PEAR_FNU),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(:LOG_ECOLI_PEAR )) ;
obj << Prediction Formula;

V

learning_JSL
Level IV

Re: need to modify JSL code -- from a linear model fit to a polynomial curve model fit

Thank you Vvvv!    Worked perfectly!

SDF1
Super User

Re: need to modify JSL code -- from a linear model fit to a polynomial curve model fit

Hi @learning_JSL ,

 

  There are a few ways to do this. One is to add the cross term in the Fit Model platform. You can also do it in the Fit Y by X platform with Bivariate( Y(:YColumn), X(:XColumn), Fit Polynomial (2);. In the Fit Y by X platform, you can specify the polynomial degree when calling the Fit Polynomial function -- in the event you have a cubic or quartic function.

 

  Another thing that will help while learning JSL is that once you perform a task in JMP and you get the report window, you can easily see the JSL code that was needed to run that task by clicking on the red hot button next to the report window outline box (in the case of the Bivariate fit, next to bivariate) and select Save Script > To Script Window. You can also save the script as a "command" in the data table where it shows up with a green arrow next to it. Clicking on the green arrow will re-run the script. This is often helpful when needing to run the script later and not wanting to re-do everything manually.

 

Hope this helps!,

DS

learning_JSL
Level IV

Re: need to modify JSL code -- from a linear model fit to a polynomial curve model fit

Very helpful tips.  Thank you SDF1!