Subscribe Bookmark RSS Feed

Multiple range tests - parameterizing the cutoff level

Hi – if I run the following short script, I get a “letters”-style report showing which mean values corresponding to the various ages are different from which others in the “Big Class” data set. 

SigLevel = 0.01;

open("$SAMPLE_DATA/Big Class.jmp");

:age << set modeling type(Nominal);

Fit Model(

       Y(:height ),

       Effects(:age ),

       Personality( Standard Least Squares ),

       Emphasis( Effect Leverage ),

       Run(

              :height << {Summary of Fit( 0 ), Analysis of Variance( 0 ),

       Parameter Estimates( 0 ), Effect Tests( 0 ), Lack of Fit( 0 ),

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

       Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 ),

       {:sex << {LSMeans Tukey HSD( 0.05, Crosstab Report( 0 ) )}}})

       );

I want to insert a piece of script like this into a function, and parameterize the cutoff level by replacing the “0.05” in the "LSMeans Tukey HSD" option with the parameter “SigLevel” (defined at the top of the script).  Simply replacing the 0.05 with the name of the parameter doesn’t work however: the value fed into the “Fit Model” platform evidently has to be an actual number, not a parameter.  Is there a way to overcome that apparent constraint?

I'm aware that I could do it by assembling the “Fit Model” line as one long text string incorporating char(SigLevel) in the appropriate place, and then parsing the whole thing, but I’d prefer not to do that if there’s a less messy way.

Does anyone have any ideas please?

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Try Evalexpr():

SigLevel = 0.01;

open("$SAMPLE_DATA/Big Class.jmp");

:age << set modeling type(Nominal);

eval(evalexpr(Fit Model(

       Y(:height ),

       Effects(:age ),

       Personality( Standard Least Squares ),

       Emphasis( Effect Leverage ),

       Run(

              :height << {Summary of Fit( 0 ), Analysis of Variance( 0 ),

       Parameter Estimates( 0 ), Effect Tests( 0 ), Lack of Fit( 0 ),

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

       Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 ),

       {:age << {LSMeans Tukey HSD( expr(SigLevel), Crosstab Report( 0 ) )}}})

       )));

2 REPLIES
Solution

Try Evalexpr():

SigLevel = 0.01;

open("$SAMPLE_DATA/Big Class.jmp");

:age << set modeling type(Nominal);

eval(evalexpr(Fit Model(

       Y(:height ),

       Effects(:age ),

       Personality( Standard Least Squares ),

       Emphasis( Effect Leverage ),

       Run(

              :height << {Summary of Fit( 0 ), Analysis of Variance( 0 ),

       Parameter Estimates( 0 ), Effect Tests( 0 ), Lack of Fit( 0 ),

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

       Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 ),

       {:age << {LSMeans Tukey HSD( expr(SigLevel), Crosstab Report( 0 ) )}}})

       )));

Exactly what I needed.  Many thanks!