Page 1 of 1

Trimmed mean

Posted: Sun Feb 13, 2011 6:19 am
by PMaier
Hi,

I was wondering whether you had any tips on how to calculate a trimmed mean... I have a matrix of forecasting results from different models, and rather than to average them across models, I would like to calculate trimmed means - that is, exclude the highest and lowest observation and average over the rest.

I can think of a couple of complicated ways to do this, but maybe someone has a really easy solution...? :-)

Thanks, Philipp

Re: Trimmed mean

Posted: Mon Feb 14, 2011 1:32 am
by trubador
Something like the following might work for calculating the trimmed means:

Code: Select all

vector trmean = (@rows(ymat)*@cmean(ymat)-(@cmin(ymat)+@cmax(ymat)))/(@rows(ymat)-2)

Re: Trimmed mean

Posted: Mon Feb 14, 2011 9:05 am
by EViews Gareth
or,

Code: Select all

smpl @first+1 @last-1 scalar mean = @mean(x)
Or for more general trimming, use the Trim Add-in.

Re: Trimmed mean

Posted: Mon Feb 14, 2011 4:14 pm
by PMaier
Solution 1 works perfectly!

Thanks, Philipp