BaşlayınÜcretsiz Başlayın

Differencing and fitting ARMA

In this exercise you will fit an ARMA model to the Amazon stocks dataset. As you saw before, this is a non-stationary dataset. You will use differencing to make it stationary so that you can fit an ARMA model.

In the next section you'll make a forecast of the differences and use this to forecast the actual values.

The Amazon stock time series is available in your environment as amazon. The ARIMA model class is also available in your environment.

Bu egzersiz

ARIMA Models in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use the .diff() method of amazon to make the time series stationary by taking the first difference. Don't forget to drop the NaN values using the .dropna() method.
  • Create an ARMA(2,2) model using the ARIMA class, passing it the stationary data.
  • Fit the model.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Take the first difference of the data
amazon_diff = amazon.____

# Create ARMA(2,2) model
arma = ____

# Fit model
arma_results = ____

# Print fit summary
print(arma_results.summary())
Kodu Düzenle ve Çalıştır