# r HoltWintersresults, interpretation of fitted dataframe

Concerning the fitted values, the help page for the HoltWinters function states that the fitted values are:

A multiple time series with one column for the filtered series as well as for the level, trend and seasonal components, estimated contemporaneously (that is at time t and not at the end of the series).

I am somewhat confused by that last part. How do the columns line up in time?

Consider the following example:

# Fit a model without seasonality to US population data
> data(uspop)
> mod <- HoltWinters(uspop, gamma=FALSE)
> mod$fitted Time Series: Start = 1810 End = 1970 Frequency = 0.1 xhat level trend 1810 6.690000 5.31 1.380000 1820 9.043998 7.24 1.803998 1830 11.903460 9.64 2.263460 1840 15.931699 12.90 3.031699 ... 1950 142.319132 131.70 10.619132 1960 168.842540 151.30 17.542540 1970 204.904262 179.30 25.604262  Let $$\hat{y}_{t+1|t}$$ be the one-step forecast of $$y_{t+1}$$ given information available at time $$t.$$ Let $$l_t$$ and $$b_t$$ indicate the estimated level and trend at time $$t,$$ respectively. As shown in Hyndman's book, $$\hat{y}_{t+1|t} = l_t + b_t.$$ We can see in mod$fitted that xhat is equal to level + trend, i.e.,

> mod$fitted[,1] - (mod$fitted[,2]+mod\$fitted[,3])
Time Series:
Start = 1810
End = 1970
Frequency = 0.1
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


So, it would appear that the column xhat is $$\hat{y}_{t|t-1},$$ the column level is $$l_{t-1}$$ and the column trend is $$b_{t-1}?$$ This suggests that the series are contemporaneously estimated at t-1. But, this contradicts the help entry's description of fitted.

What am I missing here?

## 1 Answer

I’m pretty sure this is just a difference between what you define as $$t$$. If you look at the original data, “level” is just the previous value of the series, while “trend” is just the difference of the last two points.

So “xhat” is the estimate made at time $$t-1$$ for the current row $$t$$ using values from $$t-1$$. This is what it means by contemporaneously. You could just rewrite this all as $$t$$ and $$t+1$$.