cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
midori555
Level II

Exclude rows in Col Quantile Calculation

Hi,

I was trying to get Col Quantile( :height, 0.5, :class) but it looks like the calculation would still take the excluded rows into consideration. 

Is there a way to reject the excluded rows into Col Quantile calculation?

 

Thanks,

Midori

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Exclude rows in Col Quantile Calculation

You can check for the row being excluded within the Col Quantile() function.  Below is an example

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << New Column( "Col Quantile Height by Age",
	numeric,
	continuous,
	formula( Col Quantile(If(excluded(rowstate(Row())),., :height), 0.5, :age ) )
);

Whenever the excluded rowstate changes for the rows in the data table, the formula will calculate new values

Jim

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: Exclude rows in Col Quantile Calculation

You can check for the row being excluded within the Col Quantile() function.  Below is an example

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << New Column( "Col Quantile Height by Age",
	numeric,
	continuous,
	formula( Col Quantile(If(excluded(rowstate(Row())),., :height), 0.5, :age ) )
);

Whenever the excluded rowstate changes for the rows in the data table, the formula will calculate new values

Jim

Re: Exclude rows in Col Quantile Calculation

 
 
I tried to create a loop to collect the 50th percentile of many parameters using the following code, but both elements in "test_list" are the same (they are both 50% of weight). However, if I run the lines manually, it will work. Can I not use the Col Quantile() function in the for loop?
 
 
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

plot_param={
	
	height,
	weight};

test_list={};

for(plotcnt=1, plotcnt<=nitems(plot_param), plotcnt++,

	pct_50=Col Quantile( If(excluded(rowstate(Row())),., column(plot_param[plotcnt])), 0.5);
	test_list[plotcnt]=pct_50;
);

Re: Exclude rows in Col Quantile Calculation

I tried to create a loop to collect the 50th percentile of many parameters using the following code, but both elements in "test_list" are the same (they are both 50% of weight). However, if I run the lines manually, it will work. Can I not use the Col Quantile() function in the for loop?

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
 
plot_param={
 
height,
weight};
 
test_list={};
 
for(plotcnt=1, plotcnt<=nitems(plot_param), plotcnt++,
 
pct_50=Col Quantile( If(excluded(rowstate(Row())),., column(plot_param[plotcnt])), 0.5);
test_list[plotcnt]=pct_50;
);
 
 
 
hogi
Level XI

Re: Exclude rows in Col Quantile Calculation

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
plot_param={
	height,
	weight};
test_list={};

for(plotcnt=1, plotcnt<=nitems(plot_param), plotcnt++,

	Eval (Substitute (Expr(pct_50=Col Quantile( If(excluded(rowstate(Row())),., _col_), 0.5)), Expr(_col_), column(plot_param[plotcnt])));
	test_list[plotcnt]=pct_50;
);

 

 

 

hogi
Level XI

Re: Exclude rows in Col Quantile Calculation

Due to a typo, I just noticed that Eval (substitute()) is enough, even if you substitute 1 with 1:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
plot_param = {height, weight};
test_list = {};
For( plotcnt = 1, plotcnt <= N Items( plot_param ), plotcnt++, 

	pct_50 = Eval( Substitute( Expr( Col Quantile( If( Excluded( Row State( Row() ) ), ., Column( plot_param[plotcnt] ) ), 0.5 ) ), 1, 1 ) );
	test_list[plotcnt] = pct_50;
);
show(test_list);

 

hogi_0-1711121159394.png