On Wed, 21 Sep 2011, Sven Schreiber wrote:
the formula for Theil's U that you get in gretl's fcstats()
doesn't work
if (some of) the values of y are zero (division by zero problem). I'm
not an expert in these measures and haven't spent much time on this, but
I came across a claim that another formula would also represent Theil's
U; for that other formula zeros are not a problem, and below I include a
straightforward function implementation of that other formula. Haven't
checked yet whether for non-zero y the two approaches produce the same
value.
Can anybody clarify the relationship between these approaches?
The version used by gretl (which, as you say, is not defined
for the case where the series to be forecast contains zeros)
is Theil's "U2". The alternative formula in your function
below is Theil's "U1" (see chapter 25 of the Gretl User's
Guide). The two measures are not equivalent in the non-zero
case, and my reading of the forecasting literature is that U2
is considered superior. I suppose it might be worth giving U1
when U2 is undefined but I wouldn't rate that a high priority.
function scalar manualTheilU(matrix y, matrix f)
numerator = sqrt(mean((y-f).^2))
denom1 = sqrt(mean(f.^2))
denom2 = sqrt(mean(y.^2))
return numerator/(denom1+denom2)
end function
Allin