Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detailed Model Summary in na_kalman() #45

Open
csglui opened this issue Aug 4, 2020 · 2 comments
Open

Detailed Model Summary in na_kalman() #45

csglui opened this issue Aug 4, 2020 · 2 comments

Comments

@csglui
Copy link

csglui commented Aug 4, 2020

The interpolation result by na_kalman() is pretty good when the option model='auto.arima' is used. Is it possible to show the searched parameter results of auto.arima()?

Did the package use the default search parameter settings of auto.arima() in the forecast package?

Thanks in advance.

@SteffenMoritz
Copy link
Owner

SteffenMoritz commented Aug 4, 2020

Yes, you are totally correct. It uses the default search parameters of auto.arima() from forecast.

So just run the following on your series:
(tsAirgap is just an example time series with NAs)

library("forecast")
auto.arima(tsAirgap)

Series: tsAirgap
ARIMA(0,1,1)(0,1,0)[12]

Coefficients:
ma1
-0.3745
s.e. 0.0918

sigma^2 estimated as 145.2: log likelihood=-466.04
AIC=936.09 AICc=936.18 BIC=941.84

This are then the ARIMA parameters for model='auto.arima'.

If you think there is a model that fits the time series better, you can also supply a ARIMA model you created:

# Example 5:  Perform imputation with KalmanSmooth and user created model
usermodel <- arima(tsAirgap, order = c(1, 0, 1))$model
na_kalman(tsAirgap, model = usermodel)

Thanks for your question 👍
Maybe it a good idea to think about providing more information with the output itself.
(to avoid this kind of workarounds) I'll keep this in mind for future versions.

@SteffenMoritz
Copy link
Owner

Just as an addition:

Parameters from auto.arima will also be forwarded, if you supply them to na_kalman.

So you could also call:
na_kalman(tsAirgap, model ="auto.arima", seasonal = F)

You would get a different model then before.
seasonal is a parameter from forecast::auto.arima - which restricts to non-seasonal models when set false.

auto.arima(tsAirgap, seasonal = F)

ARIMA(0,1,4)

Coefficients:
ma1 ma2 ma3 ma4
0.3683 -0.1873 -0.2327 -0.5088
s.e. 0.0901 0.0992 0.0726 0.1025

sigma^2 estimated as 785.4: log likelihood=-625.33
AIC=1260.65 AICc=1261.09 BIC=1275.47

As you can see at the results, this now finds a different (in this case way worse model).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants