Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: times
See also: armacls armalik ariols arima11 arimaf

Quantlet: arimacls
Description: Estimation of ARIMA(p,d,q) models by conditional least squares, where residuals diagnostics and model selection criteria are given. Residuals diagnostics include their timeplot with two-standard error bounds, correlograms and the Ljung-Box statistic with p-values. Computed model selection criteria are AIC and BIC.

Reference(s):

Usage: A = arimacls(y,p,d,q,const{,rcheck{,msc}})
Input:
y input series length n
p integer, order of autorregressive process
d integer, order of differences
q integer, order of moving average process
const string, if const = "constant" a constant is estimated
rcheck optional string, residual diagnostic checking. if rcheck = "rcheck", residual diagnostics are calculated and plots of the residuals and the corresponding correlograms are displayed, if rcheck = "prcheck", the plots are omitted
msc optional string, if msc = "msc" model selection criteria are computed.
Output:
A.b gives the estimated coefficients. If const = "constant", the first element is the estimated constant term
A.wnv estimated variance of the innovations
A.conver list containing: 1. the number of iterations, 2. 0-1 scalar indicating convergence
A.checkr if rcheck = "prcheck", a list is given that contains residuals diagnostics: 1. res = (n-max(p,q)) x 1 vector of residuals (i.e., one step ahead prediction errors computed with estimated parameters), 2. stat = scalar with statistic for testing H0: zero mean innovations (asymptotically normal under H0) and 3. acfQ = 30 x 4 matrix with the residuals acf, Ljung-Box statistic with p-values and pacf. The p-values are computed for M>p+q, and the first p+q values are filled with zeros. if rcheck = "rcheck", the output contains all of the above mentioned residual diagnostics and plots additionally the residuals and their acf and pacf (correlograms) Otherwise, checkr is a list containing the residuals.
A.ic if msc = "msc", 2 x 1 vector containing two model selection criteria: the Akaike Information Criterion, AIC, and the Schwarz Information Criterion, SIC. Otherwise, ic = 0.

Example:
; Example 1: nonzero mean process, estimation and residuals diagnostics
library("times")            ; loads the times library Qs
ma = #(0.7,-0.2)            ; coefficients of the MA(2) process
randomize(33)               ; sets the seed
z = genarma(0,ma,normal(300)) + 3
; z is a MA(2) series with mean = 3
; innovations are generated from NID(0,1)
A = arimacls(z,0,0,2,"constant","prcheck")
A.b                         ; estimated coefficients
A.wnv                       ; estimated residual variance
A.checkr.stat               ; test for zero-mean residuals
A.checkr.acfQ[3:10|25,2:3]  ; Ljung-Box statistic with p-values

Result:
Contents of b
	[1,]   2.9423
	[2,]  0.71713
	[3,] -0.16703

Contents of wnv
	[1,]   1.0486

Contents of stat
[1,]  -0.026312

Contents of _tmp
	[1,]   1.8504  0.17373
	[2,]   2.8827  0.23661
	[3,]   3.3295  0.34355
	[4,]   3.3307  0.50409
	[5,]   4.0214  0.54634
	[6,]   4.6462  0.58993
	[7,]   6.8113  0.44879
	[8,]   6.8421  0.55376
	[9,]   25.598  0.32019
Example:
; Example 2: zero mean process, estimation and model selection criteria
library("times")      ; loads the times library Qs
ar = #(0.7,-0.2)      ; coefficients of the AR(2) process
randomize(33)         ; sets the seed
z = genarma(ar,0,normal(300))
; z is an AR(2) series with mean = 0
; innovations are generated from NID(0,1);
A = arimacls(z,2,0,0,"noconstant","0","msc")
A.checkr.res[1]       ; first residual
A.ic                  ; AIC(first row) and BIC(second row)

Result:
Contents of _tmp
[1,] -0.071662

Contents of ic
[1,]  0.058868
[2,]  0.08368



Author: P. Moral, P. González, 20020706
(C) MD*TECH Method and Data Technologies, 05.02.2006