#general

Title

n

Naren Castellon

07/21/2023, 3:54 PMHello Team Nixtla!!!
I have some doubts about it!!!
1. What would be the difference between the predictions and the fitted values of a model?
2. When can or at what moment should I use the fitted values for an analysis?
3. Can I compare the predictions vs the fitted values?
4. Can I use the fitted values instead of using the predictions or forecast?
For example, when using statsmodels, they often plot the fitted values as if they were the predictions as shown in the following example:

`import pandas as pd`

`import matplotlib.pyplot as plt`

`from statsmodels.tsa.api import ExponentialSmoothing`

`# Import the data`

`#df = pd.read_csv("<https://raw.githubusercontent.com/Naren8520/Time-Series-with-Machine-Learning/main/Data/ads.csv>")`

`# Calculate the exponentially smoothed data`

`esm = ExponentialSmoothing(df['y'] )`

`esm_fit = esm.fit()`

`# Plot the data and the exponentially smoothed data`

`plt.plot(df['y'])`

`plt.plot(esm_fit.fittedvalues)`

`plt.title('Exponential Smoothing')`

`plt.xlabel('Time')`

`plt.ylabel('Value')`

`plt.show()`

Can I use this same Statsmodel idea with StatsForecast?m

Monica Scott

07/21/2023, 6:19 PMHi Naren, a time series forecast creates a model that it uses to "predict" historical values as well as to predict future values. So fitted values are the historical predictions, while predictions are the future predictions. For example, your forecast model might calculate a fitted value of 20 units sold on Aug 2019, but you actually sold 15, so the error was 5 units. You want to compare all the fitted values (historical predictions) to the corresponding actual values on each date in order to judge the accuracy of your model. There's lots of different error metrics you can calculate to gauge model accuracy - MSE, MAE, MASE, MAPE, etc.

n

Naren Castellon

07/21/2023, 6:27 PMYour comment is very good, but what happens... the fitted values behave very well with the historical data, it could be said that the model learned quite well from that, on the other hand when you make the predictions, for this specific model, the predictions are a straight line, so that can cause confusion when using said information for the person who has the library and the function.

m

Monica Scott

07/21/2023, 6:57 PMFor simple exponential smoothing, you may get a "straight line" prediction if the data shows a constant trend or if there's no significant trend or seasonality.

n

Naren Castellon

07/21/2023, 7:07 PMThe Simple (Simple) Exponential Smoothing Model is good when the data does not show a clear trend or seasonal pattern.
The question I was asking was other... But now, what happens if the values of the fitted values are very similar to the historical data and the predictions are a straight line that does not have a behavior to the historical data (for me that model does not work for me), I am looking for a model in the predictions that gives me a behavior similar to the historical data, which I do with the fitted values, with these values I really do nothing.

m

Monica Scott

07/21/2023, 7:16 PMSES essentially assigns exponentially decreasing weights to past observations and averages them to create a forecast. So, if your time series data has no significant trend or seasonality, and is roughly oscillating around a constant mean, SES will forecast a line that is a continuation of the last data point.

👍 1

Try experimenting with some other models