# ARMA fitting

Home 21090308 Forums Numerical Method Statistics ARMA fitting

Tagged:

Viewing 7 posts - 1 through 7 (of 7 total)
• Author
Posts
• #5611
dayyoung0324
Member

I wanna forecast a value by fitting an ARIMA model based on a time series of historical records. I’ve used the trial SuanShu 3.4.0 API. With this trial API, could I train ARMA model parameters and predict the next term value? Does the offical version of SuanShu provide some simple examples or user manual about ARIMA mode. I am new with Suanshu and any advise or help will be appreciated. Thank you.

#5612
Ryu
Member

The full version of SS has classes to estimate ARMA models. Please see these examples.

http://redmine.numericalmethod.com/projects/public/repository/entry/Examples/src/main/java/com/numericalmethod/suanshu/examples/LinearTimeSeries.java

But the free version does not allow using the statistical API. You may request a full one month trial license by emailing info [a t] nm [d o t] sg

#5613
dayyoung0324
Member

In ARMA modeling, the first step is to identify the model (i.e., the values of p for AR and q for MA) by looking at plots of the ACF and PACF. Is it possible to realize this step by SuanShu API (without figuring out these two plots)?

#5614
Ryu
Member

Here is what we/SuanShu suggests:

1.
Determine the lags (p and q) of the ARMA process and fit an ARMA(p, q) model. This is done by the usual ARMA fitting procedure., e.g., ConditionalSumOfSquares
2.
Select a suitable set of orders (P, Q) for the GARCH process. We can do this by looking at the PACF and ACF of the squared residuals and possibly use Ljung-Box test.
3.
Fit a pure GARCH(P, Q) model to the residuals using conditional MLE.
4.
Diagnostic checks.

You can do all steps 1 – 4 in SuanShu by calling the appropriate classes.

#5638
dayyoung0324
Member

Thank you for your guidance. After reviewing the discussions shown in the C# topics, it helps me a lot, even if I purchased SuanShu JAVA version. I have a question about how to determine suitable p lags for AR model and q lags for MA model by SuanShu. In principle, the first step of modeling ARMA is to identify p and q lags by looking at “plots” of the ACF and PACF. Does this step correspond to STEP 2 (or STEP 1) you mentioned? In SuanShu, should we plot ACF and PACF to determine suitable p for AR model and q for MA model?

#5639
dayyoung0324
Member

Hello,

I think I got a solution to my previous question. I follow the following reference.
https://www.quantstart.com/articles/Autoregressive-Moving-Average-ARMA-p-q-Models-for-Time-Series-Analysis-Part-3

Choosing the Best ARMA(p,q) Model

In order to determine which order p,q of the ARMA model is appropriate for a series, we need to use the AIC (or BIC) across a subset of values for p,q, and then apply the Ljung-Box test to determine if a good fit has been achieved, for particular values of p,q.

To show this method we are going to firstly simulate a particular ARMA(p,q) process. We will then loop over all pairwise values of p∈{0,1,2,3,4} and q∈{0,1,2,3,4} and calculate the AIC. We will select the model with the lowest AIC and then run a Ljung-Box test on the residuals to determine if we have achieved a good fit.

We will now create an object final to store the best model fit and lowest AIC value. We loop over the various p,q combinations and use the current object to store the fit of an ARMA(i,j) model, for the looping variables i and j.

If the current AIC is less than any previously calculated AIC we set the final AIC to this current value and select that order.

#5640
Ryu
Member
Viewing 7 posts - 1 through 7 (of 7 total)
• You must be logged in to reply to this topic.