Forum Numerical Method Statistics
ARMA fitting
-
TAYUAN HSUParticipant 2016-11-15 at 2:22 pm
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.
-
RyuParticipant 2016-11-16 at 5:06 pm
The full version of SS has classes to estimate ARMA models. Please see these examples.
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
-
TAYUAN HSUParticipant 2016-11-22 at 10:33 pm
Thank you for your response. 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)?
-
RyuParticipant 2016-11-24 at 2:49 pm
Here is what we/SuanShu suggests:
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.,
ConditionalSumOfSquares2. 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.
See this for more information:
<iframe class=“wp-embedded-content” sandbox=“allow-scripts” security=“restricted” src=“/forums/topic/question-about-arma-in-new-c-version-of-suanshu/embed/” data-secret=“zcejoHTzam” width=“600” height=“338” title=““Question about ARMA in new C# version of Suanshu” — Numerical Method Inc.” frameborder=“0” marginwidth=“0” marginheight=“0” scrolling=“no”></iframe>
-
TAYUAN HSUParticipant 2017-03-06 at 3:21 am
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?
-
TAYUAN HSUParticipant 2017-03-14 at 2:53 am
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.
-
RyuParticipant 2017-03-14 at 8:50 am
Yes. Alternatively, you may use this class which automates the trial loop.