Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Autoregression | Stationary Models
Time Series Analysis
course content

Зміст курсу

Time Series Analysis

Time Series Analysis

1. Time Series: Let's Start
2. Time Series Processing
3. Time Series Visualization
4. Stationary Models
5. Non-Stationary Models
6. Solve Real Problems

bookAutoregression

Let's move on to the review of the autoregressive model:

The formula is similar to the linear regression formula, which is where the name comes from. Instead of the coefficient - the past value of x is used.

With statsmodels we can run an autoregressive model AutoReg():

If you notice, the predictions made by the autoregressive model are more accurate than those of the simple moving average.

Let's learn how to evaluate the received results of the trained models. The error is calculated using the mean-squared error. This is done simply with the help of functions sqrt() and mean_squared_error():

In the same way, we calculate the error value for the previous model:

The smaller the MSE value, the correspondingly smaller the error.

Завдання
test

Swipe to show code editor

Create an autoregressive model and train it on the dataset shampoo.csv.

  1. Create an autoregression model (Autoreg) with 6 lags for the "Sales" column of the df DataFrame.
  2. Fit the model to data.
  3. Make predictions using the model. Start forecasting at the first row (the start parameter), and set the dynamic parameter to False.
  4. Visualize the results: show the first 150 observations of the "Sales" column of the df DataFrame within the first call of the .plot() function and the first 150 predicted values within the second call.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 3
toggle bottom row

bookAutoregression

Let's move on to the review of the autoregressive model:

The formula is similar to the linear regression formula, which is where the name comes from. Instead of the coefficient - the past value of x is used.

With statsmodels we can run an autoregressive model AutoReg():

If you notice, the predictions made by the autoregressive model are more accurate than those of the simple moving average.

Let's learn how to evaluate the received results of the trained models. The error is calculated using the mean-squared error. This is done simply with the help of functions sqrt() and mean_squared_error():

In the same way, we calculate the error value for the previous model:

The smaller the MSE value, the correspondingly smaller the error.

Завдання
test

Swipe to show code editor

Create an autoregressive model and train it on the dataset shampoo.csv.

  1. Create an autoregression model (Autoreg) with 6 lags for the "Sales" column of the df DataFrame.
  2. Fit the model to data.
  3. Make predictions using the model. Start forecasting at the first row (the start parameter), and set the dynamic parameter to False.
  4. Visualize the results: show the first 150 observations of the "Sales" column of the df DataFrame within the first call of the .plot() function and the first 150 predicted values within the second call.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 3
toggle bottom row

bookAutoregression

Let's move on to the review of the autoregressive model:

The formula is similar to the linear regression formula, which is where the name comes from. Instead of the coefficient - the past value of x is used.

With statsmodels we can run an autoregressive model AutoReg():

If you notice, the predictions made by the autoregressive model are more accurate than those of the simple moving average.

Let's learn how to evaluate the received results of the trained models. The error is calculated using the mean-squared error. This is done simply with the help of functions sqrt() and mean_squared_error():

In the same way, we calculate the error value for the previous model:

The smaller the MSE value, the correspondingly smaller the error.

Завдання
test

Swipe to show code editor

Create an autoregressive model and train it on the dataset shampoo.csv.

  1. Create an autoregression model (Autoreg) with 6 lags for the "Sales" column of the df DataFrame.
  2. Fit the model to data.
  3. Make predictions using the model. Start forecasting at the first row (the start parameter), and set the dynamic parameter to False.
  4. Visualize the results: show the first 150 observations of the "Sales" column of the df DataFrame within the first call of the .plot() function and the first 150 predicted values within the second call.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Let's move on to the review of the autoregressive model:

The formula is similar to the linear regression formula, which is where the name comes from. Instead of the coefficient - the past value of x is used.

With statsmodels we can run an autoregressive model AutoReg():

If you notice, the predictions made by the autoregressive model are more accurate than those of the simple moving average.

Let's learn how to evaluate the received results of the trained models. The error is calculated using the mean-squared error. This is done simply with the help of functions sqrt() and mean_squared_error():

In the same way, we calculate the error value for the previous model:

The smaller the MSE value, the correspondingly smaller the error.

Завдання
test

Swipe to show code editor

Create an autoregressive model and train it on the dataset shampoo.csv.

  1. Create an autoregression model (Autoreg) with 6 lags for the "Sales" column of the df DataFrame.
  2. Fit the model to data.
  3. Make predictions using the model. Start forecasting at the first row (the start parameter), and set the dynamic parameter to False.
  4. Visualize the results: show the first 150 observations of the "Sales" column of the df DataFrame within the first call of the .plot() function and the first 150 predicted values within the second call.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 4. Розділ 3
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt