AUTO_UNI_AR

   more...
Automatic selection and fitting of a univariate autoregressive time series model. The lag for the model is automatically selected using Akaike’s Information Criterion (AIC). Estimates of the autoregressive parameters for the model with minimum AIC are calculated using method of moments or maximum likelihood.
Required Arguments
W — Vector containing the stationary time series. (Input)
MAXLAG — Maximum number of autoregressive parameters requested. (Input)
NPAR — Number of autoregressive parameters. (Output)
PAR — Vector of length MAXLAG, which contains the estimates for the autoregressive parameters in the model with the minimum AIC. The estimates are in the first NPAR values of this vector. (Output)
Optional Arguments
IPRINT — Printing option. (Input)
0
No printing
1
Prints final results only
2
Prints intermediate and final results
Default: IPRINT = 0.
IMETH — Estimation method option. (Input)
0
Method of moments
1
Maximum likelihood
2
Method of least‑squares
Default: IMETH = 0.
MAXIT — Maximum number of estimation iterations. (Input)
Default: MAXIT = 500.
AVAR — Innovation variance. (Output)
AIC — Akaike’s Information Criterion. (Output)
FORTRAN 90 Interface
Generic: CALL AUTO_UNI_AR (W, MAXLAG, NPAR, PAR [])
Specific: The specific interface names are S_AUTO_UNI_AR and D_AUTO_UNI_AR.
Description
The routine AUTO_UNI_AR automatically selects the order of the AR model that best fits the data and then computes the AR coefficients. The algorithm used in AUTO_UNI_AR is derived from the work of Akaike, H., et. al (1979) and Kitagawa & Akaike (1978). This code was adapted from the UNIMAR procedure published as part of the TIMSAC‑78 Library.
The best‑fit AR model is determined by successively fitting AR models with 1, 2, ..., MAXLAG autoregressive coefficients. For each model, Akaike’s Information Criterion (AIC) is calculated based on the formula:
AIC = 2ln(likelihood) + 2(NPAR)
AUTO_UNI_AR uses the approximation to this formula developed by Ozaki and Oda (1979).
The best fit model is the model with minimum AIC. If the number of parameters in this model is equal to the highest order autoregressive model fitted, i.e., NPAR=MAXLAG, then a model with smaller AIC might exist for larger values of MAXLAG. In this case, increasing MAXLAG to explore AR models with additional autoregressive parameters might be warranted.
If IMETH = 0, estimates of the autoregressive coefficients for the model with the minimum AIC are calculated using method of moments. If IMETH = 1, the model with the minimum AIC is identified and coefficients are then estimated using maximum likelihood. Otherwise, if IMETH = 2, the coefficients for the model with minimum AIC are computed using the method of least‑squares.
Example
Consider the Wolfer Sunspot Data (Box and Jenkins 1976, page 530) consisting of the number of sunspots observed for each year from 1770 through 1869. In this example, AUTO_UNI_AR found the minimum AIC fit is an autoregressive model with 10 lags:
using the formula
the lag 10 AR model for this series can be represented as:
 
use auto_uni_ar_int
use wrrrn_int
use gdata_int
implicit none
! SPECIFICATIONS FOR PARAMETERS
integer, parameter :: maxlag=20
integer :: npar
real(kind(1e0)) :: aic, avar
real(kind(1e0)) :: par(maxlag)
real(kind(1e0)) :: x(176,2)
integer :: ncol, nrow
! SPECIFICATIONS FOR LOCAL VARIABLES
integer :: nout
!
call umach (2, nout)
write(nout,*) 'AIC Automatic Order selection '
write(nout,*) 'AR coefficients estimated using Maximum Likelihood'
write(nout,*)
! Get Wolfer Sunspot Data
call gdata(2,x,nrow,ncol)
! Example #1
call auto_uni_ar(x(22:,2), maxlag, npar, par, aic=aic, imeth=1,&
avar=avar)
write(nout,*) 'Order Selected: ', npar
write(nout,*) 'AIC = ', aic,' Variance = ', avar
call wrrrn('Final AR Coefficients estimated by MAXIMUM LIKELIHOOD', &
par, nra=npar, nca=1, lda=npar)
end
Output
 
AIC Automatic Order selection
AR coefficients estimated using Maximum Likelihood
Order Selected: 10
AIC = 1092.0347 Variance = 211.70743
Final AR Coefficients estimated by MAXIMUM LIKELIHOOD
1 1.243
2 -0.503
3 -0.158
4 0.230
5 -0.200
6 0.114
7 -0.079
8 0.094
9 0.010
10 0.096
Published date: 03/19/2020
Last modified date: 03/19/2020