Hi Jerry,
If you are using either `fittedvalues` or the output of the `predict` method (and assuming that `dynamic=False`, which is the default), then the values are the "one-step-ahead forecasts". This means that the predicted value for time `t` is constructed by using the data through time `t-1` (although the forecasts are conditional on the parameters; if you used `fit`, the parameters would be estimated using the entire sample),
If you are forecasting out-of-sample, then the values at horizon `h` is an `h`-step-ahead forecast. So if you have data for periods 1, 2, ..., T, then the first forecast is for period T+1 and it is also a one-step-ahead forecast, while the forecast for T+2 is a two-step-ahead forecast, and so on.
I'm not quite sure I followed your question about whether the components sum to the actual value. In general, the predicted values should not be equal to the actual values. For example, run the following code:
import statsmodels.api as sm
data = sm.datasets.macrodata.load_pandas().data['cpi']
mod = sm.tsa.UnobservedComponents(data, 'llevel')
res = mod.fit(disp=False)
# res.plot_components();
pd.concat({
'one-step-ahead': res.fittedvalues,
'actual': data
}, axis=1)
The output I get is:
one-step-ahead actual
0 0.000 28.980
1 28.980 29.150
2 29.150 29.350
3 29.350 29.370
4 29.370 29.540
.. ... ...
198 218.610 216.889
199 216.889 212.174
200 212.174 212.671
201 212.671 214.469
202 214.469 216.385
You can that the one-step-ahead prediction contained in the `fittedvalues` attribute is not equal to the actual data for any time point. (In fact, for this simple model the forecast is a random walk, so you can see that the prediction for *tomorrow* is whatever the model observed *today*).
If you'd like to share an example with some specific questions, please feel free.
Hope that helps,
Chad