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

How to use Variables for Custom Quantiles

Dear Community,

 

I've been struggling for a while now, looking for a way of replacing the hardcoded values 0.95 and 0.99 below, with variables in an Application.

 

	Continuous Distribution(
		Column( Eval( colSelect ) ),
		Horizontal Layout( 0 ),
		Histogram( 0 ),
		Vertical( 0 ),
		Std Error Bars( 1 ),
		Count Axis( 1 ),
		Show Percents( 1 ),
		Show Counts( 1 ),
		Axes on Left( 1 ),
		Outlier Box Plot( 0 ),
		Set Bin Width( 1 ),
		Custom Quantiles( 0.95, [0.95, 0.99] ),
//		Custom Quantiles( ( Eval( Percent1 ) /100 ), [( Eval( Percent1 ) /100 ), ( Eval( Percent2 ) /100 )] ),		Customize Summary Statistics(
			Std Err Mean( 0 ),
			Upper Mean Confidence Interval( 0 ),
			Lower Mean Confidence Interval( 0 ),
			Minimum( 1 ),
			Maximum( 1 )
		)
	),

This Dialog script comes with a set of custom variables, including the column to be analyzed ("colSelect"), and two Percentile values, that are all well retrieved (Show(), earlier in same script):

 

dt = DataTable("Dep0Times_Overall_IST5000");
colSelect = "Total Time From Entrance Queue To First Pre-Sortation";
Percent1 = 95; Percent2 = 99;

Whether I try the red line above with or without the Eval() method, I get the same annoying error below:

Invalid matrix token.
Line 50 Column 49: ...val( Percent1 ) /100 ), [►( Eval( Percent1 ) /100 )...

Thanks!

Stéphane DELACROIX
Senior Simulation & Planning Engineer
1 ACCEPTED SOLUTION

Accepted Solutions
HubP_SDe
Level III

Re: How to use Variables for Custom Quantiles

Jim & all,

This finally works (maybe not the most elegant syntax)

Percent1 = 95;
Percent2 = 99;
percentMatrix = Matrix( {{ Percent1 /100 }, { Percent2 /100 }} );
percentMatrix = [0.95, 0.99];
...
Custom Quantiles( ( Percent1 /100 ), percentMatrix ),

instead of:

percentMatrix = Matrix( Percent1 /100 ) || Matrix( Percent2 /100 );
percentMatrix = [0.95 0.99]

Cheers!

Stéphane DELACROIX
Senior Simulation & Planning Engineer

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to use Variables for Custom Quantiles

The percent values are elements in a matrix, if you create the matrix before the Distribution, then it is a simple substitution to have it used.

Names Default To Here( 1 );
dt = open("$SAMPLE_DATA/big class.jmp");
colSelect = "height";
percent1 = .95;
percent2 = .99;

perMatrix = Matrix( percent1 ) || Matrix( percent2 );

distribution(
	Continuous Distribution(
		Column( Eval( colSelect ) ),
		Horizontal Layout( 0 ),
		Histogram( 0 ),
		Vertical( 0 ),
		Std Error Bars( 1 ),
		Count Axis( 1 ),
		Show Percents( 1 ),
		Show Counts( 1 ),
		Axes on Left( 1 ),
		Outlier Box Plot( 0 ),
		Set Bin Width( 1 ),
		Custom Quantiles( Percent1, perMatrix ), 
//		Custom Quantiles( ( Eval( Percent1 ) /100 ), [( Eval( Percent1 ) /100 ), ( Eval( Percent2 ) /100 )] ),		Customize Summary Statistics(
		Std Err Mean( 0 ),
		Upper Mean Confidence Interval( 0 ),
		Lower Mean Confidence Interval( 0 ),
		Minimum( 1 ),
		Maximum( 1 )
	)
);
Jim
HubP_SDe
Level III

Re: How to use Variables for Custom Quantiles

Jim & all,

This finally works (maybe not the most elegant syntax)

Percent1 = 95;
Percent2 = 99;
percentMatrix = Matrix( {{ Percent1 /100 }, { Percent2 /100 }} );
percentMatrix = [0.95, 0.99];
...
Custom Quantiles( ( Percent1 /100 ), percentMatrix ),

instead of:

percentMatrix = Matrix( Percent1 /100 ) || Matrix( Percent2 /100 );
percentMatrix = [0.95 0.99]

Cheers!

Stéphane DELACROIX
Senior Simulation & Planning Engineer