For some reason, when adding to summary a Median(), it ignores the weights provided for other statistics.
Here, I am creating a simple filter where every male row has 0 weight, hence max and min for males should not exist.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// New column: Filter
dt << New Column( "Filter",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( :sex != "M" )
);
list_columns_to_group = {"height", "weight"};
// Ignores weights for max, min...
dt << Summary( Group( :Sex ),
Mean(list_columns_to_group),
Max( list_columns_to_group ),
Min(list_columns_to_group ),
Median(list_columns_to_group),
Weight(:Filter));
// Works as expected
dt << Summary( Group( :Sex ),
Mean(list_columns_to_group),
Max( list_columns_to_group ),
Min(list_columns_to_group ),
//Median(list_columns_to_group),
Weight(:Filter));
I'm just guessing, but does it make sense to apply a weight to a quantile or the cumulative distribution function?
It makes sense with moments, but maybe not with the CDF.
I have updated the description as the main issue I found is that it ignores the weights for other statistics.
About weight median, this is a topic by itself :)