Forum Numerical Method Statistics
ARIMA forecast
-
ingoguilhermeParticipant 2012-10-12 at 1:01 pm
Hi,
I have an eqully spaced N-length time series and i wanna estimate N+1. value by fitting an ARIMA model. I’ve used the code recommended by ryu. I’ve fitted a model but i only have ARMA model parameters and i don’t know how to estimate the next term. I’m new with Suanshu and any help or advise will be appreciated.
SimpleTimeSeries ts = new SimpleTimeSeries(new double[]{0.1, 0.2, 0.3}); ConditionalSumOfSquares instance = new ConditionalSumOfSquares(ts, 1, 1, 1); ARMAModel model = instance.getFittedARMA(); -
RyuParticipant 2012-10-15 at 7:05 am
You need to understand ARMA model and forecasting. Read this article: http://www.le.ac.uk/users/dsgp1/COURSES/TSERIES/7FORCAST.PDF
-
ingoguilhermeParticipant 2012-10-21 at 9:11 pm
Thanks, I’ve read the article. Basically, three methods are mentioned. Recursive method and simpler methods, Exponential Smoothing and the Holt-Winters method. They assumes forecasting functions optimal for some models such as ARIMA(0,1,1), IMA(2,2) etc. Recursive model seems appropriate but I’d like to try all three methods. However, i still don’t know how to use the SuanShu for forecasting.
-
Haksun LiModerator 2012-10-24 at 7:12 pm
The “Innovation Algorithm” in SuanShu allows you to make a 1-step ahead prediction for any stationary time series model if you have the auto-covariance function. Using it recursively allows you to make an h-step ahead prediction.
The class “AutoCovariance” allows you to compute the auto-covariance function for any ARMA process.
Combining the above allows you to do ARMA forecast.
In the upcoming release, we will make it easier to do ARMA forecast without going thru the above steps. There is an easier way/simplification when it comes to ARMA forecast.
-
ingoguilhermeParticipant 2012-10-28 at 8:57 pm
Thanks. As far as i can see, “AutoCovariance” class can get both a timeseries (univariate data set) or an ARMA Model. I gave raw time series to compute the aoutocovariance class. However, while constructing “InnovationAlgorithm” object with the time series and that covariance function, i get a “lag must be < length of the time series" exception, although i do not set any lag value. The code is given below. What is wrong? SimpleTimeSeries smts = new SimpleTimeSeries(new double[]{0.1, 0.2, 0.3}); AutoCovariance acf = new AutoCovariance(smts); InnovationAlgorithm ia = new InnovationAlgorithm(smts, acf);By the way, is the upcoming release date clear ?
-
Haksun LiModerator 2012-10-29 at 9:38 am
We have added ARMA and ARIMA forecast code in SuanShu. Please check out the examples at: http://www.numericalmethod.com/trac/numericalmethod/browser/public/Examples/src/com/numericalmethod/suanshu/examples/LinearTimeSeries.java
We are planning to release 2.0 in Dec 2012. If you need to play with it before then, please request a copy by emailing: info -at- numericalmethod -dot- com.
-
ingoguilhermeParticipant 2013-01-09 at 8:10 pm
I’m using ARMA forecast. The sample code in examples is given below;ARMAModel arma = new ARMAModel( new double[]{1.0, -0.24}, new double[]{0.4, 0.2, 0.1});I wonder, which coefficients are these values in ARMA equation. Are they the most recent 2 “X” coefficients (Phi values) and the most recent 3 error coefficients (Theta values)? If so, how they are selected, experimentally? Thanks..
-
RyuParticipant 2013-01-10 at 1:36 pm
You are correct that the first [tt:16dmvkpy]double[][/tt:16dmvkpy] are the coefficients for phi (AR) and the second one for theta (MA). They are usually selected by running a fitting model on the data set such as this one: http://www.numericalmethod.com/javadoc/suanshu/com/numericalmethod/suanshu/stats/timeseries/linear/univariate/stationaryprocess/arma/ConditionalSumOfSquares.html
-
ingoguilhermeParticipant 2013-01-11 at 10:38 pm
So, i have to fit a different model (ConditionalSumOfSquares(…)) for each dataset and then get the fitted ARMA/ARIMA model (getModel()). After that, i have to get theta and phi values from the model (phi(), theta() etc) and use them in ARMA/ARIMA forecasting. Is it right?
-
RyuParticipant 2013-01-12 at 7:54 am
Yes. That is one way to do it.
-
ingoguilhermeParticipant 2013-05-01 at 8:05 pm
Thanks for previous responses, they helped me a lot. I’ve used ConditionalSumOfSquares for fitting an ARIMA model and utilized ARMAForecastOneStep for forecasting. Now, i need to know the complexity (O(N) etc) of modelling and forecast operations. I can guess about the forecasting phase but i have no idea how ConditionalSumOfSquares.getARMA model works and what’s the complexity? The complexity or any information (about how it works) to calculate the complexity of model fitting is appreciated. Thanks in advance.
-
RyuParticipant 2013-05-02 at 3:28 pm
[tt:25kje8dt]ConditionalSumOfSquares[/tt:25kje8dt] does an MLE.
-
ingoguilhermeParticipant 2013-06-10 at 8:00 pm
Do you know how the error of ARIMA model is computed? What is the equation of model error?
-
RyuParticipant 2013-06-11 at 5:27 pm
The residuals are the difference between the observed and fitted values.
-
TAYUAN HSUParticipant 2016-11-08 at 4:26 pm
Is it possible to share the example jave file, LinearTimeSeries.java, again? (http://numericalmethod.com/trac/numericalmethod/browser/public/Examples/src/com/numericalmethod/suanshu/examples/LinearTimeSeries.java) Previous shared examples look like being removed.
-
RyuParticipant 2016-11-15 at 12:53 pm