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
David_Burnham
Super User (Alumni)

Col Functions and Row States

According to the release notes for version 15 of JMP:

The Col functions honor excluded rows through the Excluded(Row State()) function.
Col Maximum( :height, :sex, Excluded( Row State() ) );

However, this syntax doesn't seem to work.  Can anyone suggest the corect syntax?

-Dave
17 REPLIES 17
jthi
Super User

Re: Col Functions and Row States

I quickly tested and seemed that using only Excluded() seemed to work (I'm using 15.2.1).

-Jarmo
David_Burnham
Super User (Alumni)

Re: Col Functions and Row States

Thanks for letting me know.  That doesn't work with 15.1 - I'll try and do a comparison with 15.2.

-Dave
jthi
Super User

Re: Col Functions and Row States

I'll add this very simple example here if anyone else comes around:

jthi_0-1611387497073.png

 

Names Default To Here(1);
New Table("ExcludeColMax",
	Add Rows(6),
	Compress File When Saved(1),
	New Column("A",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([1, 10, 100, 2, 20, 200]),
		Set Display Width(46)
	),
	New Column("B",
		Character,
		"Nominal",
		Set Values({"A", "A", "A", "B", "B", "B"})
	),
	New Column("C",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Formula(Col Maximum(:A, :B, Excluded())),
		Set Display Width(65)
	),
	Set Row States([0, 0, 6, 6, 6, 0])
);
-Jarmo
David_Burnham
Super User (Alumni)

Re: Col Functions and Row States

I've tested with v15.2 and the issue is the same.  Note the use case is using the function within a script, not within a column formula (not sure why I would want a column statistic in a row).

-Dave
jthi
Super User

Re: Col Functions and Row States

Maybe honoring means in this case that the excluded is just additional byVar in column statistics formulas?

 

If you want maximum value of column without excluded values, could you use Summarize instead of Col Maximum? It seems to ignore excluded rows.

 

Names Default To Here(1);
dt =New Table("ExcludeColMax",
	Add Rows(6),
	Compress File When Saved(1),
	New Column("A",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([1, 10, 100, 2, 20, 200]),
		Set Display Width(46)
	),
	New Column("B",
		Character,
		"Nominal",
		Set Values({"A", "A", "A", "B", "B", "B"})
	),
	New Column("C",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Formula(Col Maximum(:A, :B, Excluded())),
		Set Display Width(65)
	),
	Set Row States([0, 0, 6, 6, 0, 6])
);

Write("Looping col max:");
For Each Row(
	Show(Col Maximum(:A, :B, Excluded()))
);

Write("\!N\!NOnly col max:"); 
Show(Col Maximum(:A, :B, Excluded()));

Write("\!N\!NSummarize:");
Summarize(dt, exg = By(:B), exm = Max(:A));
Show(Eval List({exg, exm}));
Show(Max(exm));
-Jarmo
David_Burnham
Super User (Alumni)

Re: Col Functions and Row States

I can code a solution - my question was specifically about whether version 15 allowed it to be done solely using the column functions - that was the impression I got from the release notes.

-Dave
txnelson
Super User

Re: Col Functions and Row States

Dave,
Very confusing. I think this is a question for our friend Wendy.
Jim
ian_jmp
Level X

Re: Col Functions and Row States

Interesting. A pre-release build of JMP 16 seems to get it right for r=1 and r=2, but not thereafter:

NamesDefaultToHere(1);

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

mw = J(NRow(dt), 2, .);
for(r=1, r<=NRow(dt), r++,
	Row() = r;
	RowState(Row()) = ExcludedState(1);
	mw[r,1] = ColMean(:weight, Excluded(RowState(Row())));
	mw[r,2] = ColMean(:weight, Excluded());
	RowState(Row()) = ExcludedState(0);
	);
AsTable(mw);

dt << Distribution(
			Continuous Distribution(
				Column( :weight ),
				Quantiles( 0 ),
				Histogram( 0 ),
				Outlier Box Plot( 0 )
			),
			Local Data Filter(
				Add Filter(
					columns( Transform Column( "Row", Nominal, Formula( Row() ) ) ),
					Where( Transform Column( "Row", Nominal, Formula( Row() ) ) == 1 ),
					Display(
						Transform Column( "Row", Nominal, Formula( Row() ) ),
						N Items( 15 ),
						Find( Set Text( "" ) )
					)
				)
			)
		);
David_Burnham
Super User (Alumni)

Re: Col Functions and Row States

Working with Big Class (of course):

 

colmaximum(:height,excluded(rowstate()))

This is working.  But on one computer but not another.  Both running 15.1.0. 

 

Now I am totally confused!

 

Screenshots on next post ...

-Dave