need to modify JSL code -- from a linear model fit to a polynomial curve model fitHi - 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!
Data Exploration and VisualizationRe: need to modify JSL code -- from a linear model fit to a polynomial curve model fitVery helpful tips. Thank you SDF1!
Re: need to modify JSL code -- from a linear model fit to a polynomial curve model fitHi @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
Re: need to modify JSL code -- from a linear model fit to a polynomial curve model fitThank you Vvvv! Worked perfectly!
Re: need to modify JSL code -- from a linear model fit to a polynomial curve model fitAdd 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