Reputation: 1511
I have a bar plot in Spotfire that shows the mean of a variable per group. Instead of the mean I would like to use the trimmed mean to make it more robust to outliers. I'm new to Spotfire, how do I do that? Trimmed mean means to order your values, cut off the first and last x% and take the mean over the remainder.
Upvotes: 1
Views: 187
Reputation: 25122
You can limit this using Percentile()
. You can use this in your expression or insert a calculated column. Here is the calculated column example so you can see what's limited.
On the tool bar, Insert > Calculated Column > If([ValueColumn]>=Percentile([ValueColumn],10),True,False) as [InRange]
This will set a TRUE BOOLEAN
value to each row if it is >= 10%, and a FALSE
if it is not. Instead of hard coding 10 you can use a property control if you'd like. Then, you can reference this column in your chart like:
If([InRange] = TRUE,Avg([ValueColumn])) as [LimitedMean]
I've attached an image to show the results. If this doesn't work, you can sort your data using Rank(), DenseRank(), and RankReal()
and then limit this way.
Lastly, you can do all of this "in line" in your bar chart like so:
If([ValueColumn]>=Percentile([ValueColumn],10),Avg([ValueColumn]))
Upvotes: 1