Subscribe Bookmark RSS Feed

Adding Options to the Fit Model Function

I'm writing some JSL script to fit a model to a data table. Rather than work out the syntax from scratch, I've used the usual trick of running it from the menu, and then sending the script to a script window so I can then copy, amend and/or generalize it in any way I want:

dt1i << Fit Model(

Y( :Response ),

Effects( :Respondent, :Product ),

Personality( Standard Least Squares ),

Emphasis( Minimal Report ),

Run Model(

:Response << {Lack of Fit( 0 ), Plot Actual by Predicted( 0 ),

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

Plot Effect Leverage( 0 )}

)

I now want to modify this so that I append the predicted values onto the original data set. I can do that from the menu easily enough by selecting the appropriate option after running the model, but I can't work out how to modify the above script to perform that additional task. Can anyone tell me (a) what modification I need to make, and (b) how I can determine this sort of thing for myself? I know it's very simple, but I can't find what I'm looking for in the manual here, and I haven't yet managed to hit the right syntax by trial and error.

Many thanks,

David

3 REPLIES

I've got it: you add "Predicted Values(1)" to the list of options that are sent in the above example to :Response.  The second question remains though: how can I determine the correct syntax other than by trial and error?

ms

Super User

Joined:

Jun 23, 2011

I agree that the jsl documentation is not complete. But since I learned about the indexes in the help menu there has been less trial and error.

The example below is found in the Object Scripting Index under Fitmodel/Fit Least Squares/Save Columns:

dt =

Open(

  "$English_Sample_Data/Drug.jmp"

);

obj =

Fit Model(

          Y( :y ),

          Effects( :Drug, :x ),

          Personality(

                    Standard Least Squares

          ),

          Emphasis( Minimal Report ),

          Run

);

obj << Predicted Values;

mattf

Community Trekker

Joined:

Jun 23, 2011

Hi:

More generally, one can determine what commands are available for objects via the "Show Properties( object )" command.

Including some that are scripting only.  More examples on page 20 of the => Help, Books, Scripting Guide.

obj = Fit Model(....);

Show Properties( obj );               // displays many available object commands

Best regards,

-Matt