rafat / ctsa

A Univariate Time Series Analysis and ARIMA Modeling Package in ANSI C. Updated with SARIMAX and Auto ARIMA.
https://code.google.com/p/ctsa/
Other
56 stars 24 forks source link

[Auto Arima] Auto_Arima related functions may predict incorrect results? #5

Open zoziha opened 3 years ago

zoziha commented 3 years ago

Hello, @rafat I tried your ctsa package, but found that it seems that the prediction result from the auto_arima related functions is a bit incorrect. Can you check it? Thank you~

auto_arima_test1

0.05

 Exit Status
Return Code : 1
Exit Message : Probable Success

  ARIMA Seasonal Order : ( 1, 1, 1) * (0, 0, 0)

Coefficients        Value               Standard Error

AR1              0.215257            0.10121
MA1              0.819075            0.0631273

MEAN             0
TREND            0

SIGMA^2          0.0994924

ESTIMATION METHOD : CSS-MLE

OPTIMIZATION METHOD : BFGS

AIC criterion : 108.68

BIC criterion : 118.514

AICC criterion : 108.805

Log Likelihood : -51.3401

Auto ARIMA Parameters

Approximation: FALSE
Stepwise: FALSE
Predicted Values : 17.4807 17.4975 17.5011 17.5019 17.5021
Standard Errors  : 0.313811 0.337541 0.347725 0.355671 0.363058

image

auto_arima_test2

0.05
p: 2 d: 1 q: 2 P: 1 D: 1 Q: 1 Drift/Mean: 0 ic: -398.699
p: 0 d: 1 q: 0 P: 0 D: 1 Q: 0 Drift/Mean: 0 ic: -354.135
p: 1 d: 1 q: 0 P: 1 D: 1 Q: 0 Drift/Mean: 0 ic: -399.221
p: 0 d: 1 q: 1 P: 0 D: 1 Q: 1 Drift/Mean: 0 ic: -403.494
p: 0 d: 1 q: 1 P: 0 D: 1 Q: 0 Drift/Mean: 0 ic: -369.379
p: 0 d: 1 q: 1 P: 1 D: 1 Q: 1 Drift/Mean: 0 ic: -400.008
p: 0 d: 1 q: 1 P: 0 D: 1 Q: 2 Drift/Mean: 0 ic: -401.604
p: 0 d: 1 q: 1 P: 1 D: 1 Q: 0 Drift/Mean: 0 ic: -401.702
p: 0 d: 1 q: 1 P: 1 D: 1 Q: 2 Drift/Mean: 0 ic: -407.71
p: 0 d: 1 q: 1 P: 2 D: 1 Q: 2 Drift/Mean: 0 ic: -410.034
p: 0 d: 1 q: 1 P: 2 D: 1 Q: 1 Drift/Mean: 0 ic: -410.037
p: 0 d: 1 q: 1 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -411.992
p: 0 d: 1 q: 0 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -398.065
p: 1 d: 1 q: 1 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -409.417
p: 0 d: 1 q: 2 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -410.088
p: 1 d: 1 q: 0 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -408.77

 Exit Status
Return Code : 1
Exit Message : Probable Success

  ARIMA Seasonal Order : ( 0, 1, 1) * (2, 1, 0)

Coefficients        Value               Standard Error

MA1              0.425617            0.0862409
SAR1             -0.558599           0.0895498
SAR2             -0.197882           0.0973616

MEAN             0
TREND            0

SIGMA^2          0.00140784

ESTIMATION METHOD : CSS-MLE

OPTIMIZATION METHOD : BFGS

AIC criterion : -479.278

BIC criterion : -467.777

AICC criterion : -478.961

Log Likelihood : 243.639

Auto ARIMA Parameters

Approximation: TRUE
Stepwise: TRUE

Forecast : 5 Point Look Ahead
Predicted Values : 6.11024 6.05009 6.16814 6.1935 6.23349
Standard Errors  : 1.03779 1.0437 1.04894 1.05371 1.05811

image

rafat commented 3 years ago

In the second case, it seems to be a logarithmic issue. The output values are the log values of the real values. I'll modify the test code if that's where the error is.

On 6/23/21, zoziha @.***> wrote:

Hello, I tried your ctsa package, but found that it seems that the prediction result from the auto_arima related functions is a bit incorrect. Can you check it? Thank you~

auto_arima_test1

0.05

 Exit Status
Return Code : 1
Exit Message : Probable Success

  ARIMA Seasonal Order : ( 1, 1, 1) * (0, 0, 0)

Coefficients        Value               Standard Error

AR1              0.215257            0.10121
MA1              0.819075            0.0631273

MEAN             0
TREND            0

SIGMA^2          0.0994924

ESTIMATION METHOD : CSS-MLE

OPTIMIZATION METHOD : BFGS

AIC criterion : 108.68

BIC criterion : 118.514

AICC criterion : 108.805

Log Likelihood : -51.3401

Auto ARIMA Parameters

Approximation: FALSE
Stepwise: FALSE
Predicted Values : 17.4807 17.4975 17.5011 17.5019 17.5021
Standard Errors  : 0.313811 0.337541 0.347725 0.355671 0.363058

image

auto_arima_test2

0.05
p: 2 d: 1 q: 2 P: 1 D: 1 Q: 1 Drift/Mean: 0 ic: -398.699
p: 0 d: 1 q: 0 P: 0 D: 1 Q: 0 Drift/Mean: 0 ic: -354.135
p: 1 d: 1 q: 0 P: 1 D: 1 Q: 0 Drift/Mean: 0 ic: -399.221
p: 0 d: 1 q: 1 P: 0 D: 1 Q: 1 Drift/Mean: 0 ic: -403.494
p: 0 d: 1 q: 1 P: 0 D: 1 Q: 0 Drift/Mean: 0 ic: -369.379
p: 0 d: 1 q: 1 P: 1 D: 1 Q: 1 Drift/Mean: 0 ic: -400.008
p: 0 d: 1 q: 1 P: 0 D: 1 Q: 2 Drift/Mean: 0 ic: -401.604
p: 0 d: 1 q: 1 P: 1 D: 1 Q: 0 Drift/Mean: 0 ic: -401.702
p: 0 d: 1 q: 1 P: 1 D: 1 Q: 2 Drift/Mean: 0 ic: -407.71
p: 0 d: 1 q: 1 P: 2 D: 1 Q: 2 Drift/Mean: 0 ic: -410.034
p: 0 d: 1 q: 1 P: 2 D: 1 Q: 1 Drift/Mean: 0 ic: -410.037
p: 0 d: 1 q: 1 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -411.992
p: 0 d: 1 q: 0 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -398.065
p: 1 d: 1 q: 1 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -409.417
p: 0 d: 1 q: 2 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -410.088
p: 1 d: 1 q: 0 P: 2 D: 1 Q: 0 Drift/Mean: 0 ic: -408.77

 Exit Status
Return Code : 1
Exit Message : Probable Success

  ARIMA Seasonal Order : ( 0, 1, 1) * (2, 1, 0)

Coefficients        Value               Standard Error

MA1              0.425617            0.0862409
SAR1             -0.558599           0.0895498
SAR2             -0.197882           0.0973616

MEAN             0
TREND            0

SIGMA^2          0.00140784

ESTIMATION METHOD : CSS-MLE

OPTIMIZATION METHOD : BFGS

AIC criterion : -479.278

BIC criterion : -467.777

AICC criterion : -478.961

Log Likelihood : 243.639

Auto ARIMA Parameters

Approximation: TRUE
Stepwise: TRUE

Forecast : 5 Point Look Ahead
Predicted Values : 6.11024 6.05009 6.16814 6.1935 6.23349
Standard Errors  : 1.03779 1.0437 1.04894 1.05371 1.05811

image

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/rafat/ctsa/issues/5

zoziha commented 3 years ago

Hello, your open source ctsa is great! It is a comprehensive and modern time series analysis package. Fortran-Lang is rebuilding its community. I personally want to use your ctsa package and set up the c-fortran interface and open it up in zoziha/fortsa. But I noticed that your license file is BSD-3, and there is an extra statement: All rights reserved (see https://github.com/rafat/ctsa/blob/d0c7045eabf73cf5753eee9324046e60b930af2b/COPYRIGHT#L2). Does this create ambiguity with BSD-3 license? Do I need to get your permission very clearly to release the open source ctsa/fortran binding interface package (fortsa)? Hope to hear from you~

rafat commented 3 years ago

Hi,

The license is BSD-3. Please feel free to use it as you please. I'll be looking forward to your Fortran interface.

Rafat

On 7/9/21, zoziha @.***> wrote:

Hello, I think your open source ctsa is very good. It is a comprehensive and modern time series analysis package. Fortran is rebuilding its community. I personally want to use your ctsa package and set up the c-fortran interface and open it up in zoziha/fortsa. But I noticed that your license file is BSD-3, and there is an extra statement: All rights reserved (see https://github.com/rafat/ctsa/blob/d0c7045eabf73cf5753eee9324046e60b930af2b/COPYRIGHT#L2). Does this create ambiguity with BSD-3 license? Do I need to get your permission very clearly to release the open source ctsa/fortran binding interface package (fortsa). Hope to hear from you~

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/rafat/ctsa/issues/5#issuecomment-876960104

MagicJMark commented 2 years ago

Hi, First of all, thank you very much for providing such an excellent source 'ctsa'. But I also found some problems with predictions. For example, I used the FORECAST function of MATLAB for series_A to forecast the same set of data, and there was a difference between the forecast data by this program. And through comparison, I found that when modeling ARIMA, the program did not consider the influence of the constant term, but MATLAB did. Is this the reason for the different prediction? The same problem arises in series_B. Predictions for series_C are even less credible. series_A: image image series_B: image image series_C: image image