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
anne_sa
Level VI

Fit together / Fit separately (Fit Model)

Hello everyone,

I would like to find a way, using JSL, to precise if I want to "fit separately" or "fit together" when there is missing values different across Y columns.

The following script enables to fit separately:

Fit Group(

    Fit Model(

        Y( :Y1 ),

        Effects( :X ),

        Personality( "Standard Least Squares" ),

        Emphasis( "Effect Leverage" ),

        Run()

    ),

    Fit Model(

        Y( :Y2 ),

        Effects( :X ),

        Personality( "Standard Least Squares" ),

        Emphasis( "Effect Leverage" ),

        Run()

    )

);

And this one to fit together:

Fit Model(

    Y( :Y1, :Y2 ),

    Effects( :X ),

    Personality( "Standard Least Squares" ),

    Emphasis( "Effect Leverage" ),

    Run()

);

But my problem is that I need to use the Fit Model function, after cliking on a button.

If I insert the previous script in a Button Box it does not work properly and I do not understand why:

new window("test",bb=button box("Fit Model"));

bb<<set function(

    Fit Model(

    Y( :Y1, :Y2 ),

    Effects( :X ),

    Personality( "Standard Least Squares" ),

    Emphasis( "Effect Leverage" ),

    Run()

)  

);

When I click on the button, JMP opens the window to ask the user if he want to fit separately or fit together, instead of directly fitting together.

Do you have an idea of how I could fix this ?

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Fit together / Fit separately (Fit Model)

It is strange and it may be a bug.

As a workaround, try a where-clause:

bb1 << set function( New Window("Fit Model Together",

        Fit Model(

            Y(:height, :weight),

            Effects(:sex),

            Personality("Standard Least Squares"),

            Emphasis("Effect Leverage"),

            where(!Is Missing(:height) & !Is Missing(:weight)),

            Run()

        )

    )

);

View solution in original post

6 REPLIES 6
ian_jmp
Level X

Re: Fit together / Fit separately (Fit Model)

Yes, I see the effect too (JMP 12.1 on the Mac).

If you press the 'Together' button, JMP tries to be helpful and pops up this:

11061_Screen Shot 2016-02-25 at 09.58.52.png

but, if you run the code behind the button directly it doesn't (which is the desired behaviour). No good idea how to stop this, unfortunately. Please mail support@jmp.com and reference this thread.

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// Decimate the responses a little to make a difference between the fits

Column(dt, "height")[RandomIndex(NRow(dt), 10)] = .;

Column(dt, "weight")[RandomIndex(NRow(dt), 10)] = .;

New Window( "test", bb1 = Button Box( "Fit Model Together" ), bb2 = Button Box( "Fit Model Separately" ) );

bb1 << set function(

NewWindow("Fit Model Together",

Fit Model(

Y( :height, :weight ),

Effects( :sex ),

Personality( "Standard Least Squares" ),

Emphasis( "Effect Leverage" ),

Run()

)

)

);

bb2 << set function(

NewWindow("Fit Model Separately",

Fit Model(

Y( :height),

Effects( :sex ),

Personality( "Standard Least Squares" ),

Emphasis( "Effect Leverage" ),

Run()

),

Fit Model(

Y( :weight),

Effects( :sex ),

Personality( "Standard Least Squares" ),

Emphasis( "Effect Leverage" ),

Run()

)

)

);

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Fit together / Fit separately (Fit Model)

Just want to add that the pop-up is suppressed if Fit Model is explicitly told to fit separately.

bb1 << set function(

NewWindow("Fit Model Together",

Fit Model(

Y( :height, :weight ),

Effects( :sex ),

Personality( "Standard Least Squares" ),

Emphasis( "Effect Leverage" ),

Run("Fit Separately")

)

)

);

anne_sa
Level VI

Re: Fit together / Fit separately (Fit Model)

Indeed it works easily and perfectly with "Fit Separately", thanks !

Unfortunately I have tried with "Fit Together" and the pop-up still appears. Is there another way to precise explicitly that we want to fit together?

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Fit together / Fit separately (Fit Model)

It is strange and it may be a bug.

As a workaround, try a where-clause:

bb1 << set function( New Window("Fit Model Together",

        Fit Model(

            Y(:height, :weight),

            Effects(:sex),

            Personality("Standard Least Squares"),

            Emphasis("Effect Leverage"),

            where(!Is Missing(:height) & !Is Missing(:weight)),

            Run()

        )

    )

);

anne_sa
Level VI

Re: Fit together / Fit separately (Fit Model)

Thanks a lot! I wouldn't have thought using a where clause right here.

Furthermore I have just found an other interesting discussion:

Re: A JSL scripting question: JMP alert Please select the rows to be deleted

Using the option Batch interactive seems to fix the problem as well.

ian_jmp
Level X

Re: Fit together / Fit separately (Fit Model)

Interesting. I didn't know about that "Batch Interactive" switch.