UTA package

Univariate Time Series Analysis

Hi Justin, please see below for examples with information matrix.  This package handles multiplicative seasonal.  I expect the Fractional differencing part contains the same error that you discovered earlier with the R code.  As I show the approximate method below.

As in my 1978 JRSS B paper (see eqn 45), we define, X, so that X'X≐ℐ, where ℐ is the information matrix. In this illustration I will only compute the block of ℐ corresponding to ar and sar as above. The rest of the computation follows the same principle.

How to install

Locate the installation directory for Mathematica - in Windows usually Program Files ...

Copy the files DatIO.m, QUtil.m and UTA.m to the subdirectory AddOns/Applications.

You can then load with Needs or Get etc.

Contents

Needs["UTA`"]

?UTA`*

ARMA(2,2)

phi={(Subscript[ϕ, 1]),(Subscript[ϕ, 2])};theta={(Subscript[θ, 1]),(Subscript[θ, 2])};

ans=InformationMatrixARMA[phi,theta]

MatrixForm[ans]

Numerical example with seasonal case

?GenerateARMAPolynomial

ar=GenerateARMAPolynomial[{0.5,0.7}];

sar=GenerateARMAPolynomial[{-0.5,0.2}];

ma=GenerateARMAPolynomial[{-0.4,-0.6}];

sma=GenerateARMAPolynomial[{0.4,-0.6}];

Note: exact computation with rational numbers is used, so we have used N to convert to floating point,

ans=InformationMatrixARMA[ar,ma,sar,sma,12]//N

Dimensions[ans]

Rounding to 3 decimals,

MatrixForm[Round[ans,0.001]]

The information matrix for the ar-sar parameters:

ans[[{1,2},{5,6}]]//MatrixForm

The information matrix for the arma parameters:

ans[[{1,2,3,4},{1,2,3,4}]]//MatrixForm

Checking result -- first ARMA part

tccf functions

The functions tccf and tccfseasonal solve linear equations to obtain the exact large-sample information matrix.  These functions are used by InformationMatrixARMA.  These are the functions you need to write in R.

?tccf

tccf/: tccf[phi_, theta_] := 
   Module[{k, rhs, amatrix}, k = Length[phi] + Length[theta]; 
     rhs = Table[0, {k}]; rhs[[1]] = -1; 
     amatrix = Table[getaij[phi, theta, i, j], {i, k}, {j, k}]; 
     LinearSolve[amatrix, rhs]
     ];

(* getaij - utility function required by tccf*) 
getaij/: getaij[phi_, theta_, (i_Integer)?Positive, (j_Integer)?Positive] := 
   Module[{p, q, imj, ijq}, p = Length[phi]; q = Length[theta]; imj = i - j; 
     ijq = (i + j) - q - 1; Return[Which[i > q && i > j && imj <= q, 
       Rationalize[theta[[imj]]], i > q && imj == 0, -1, 
       i <= q && ijq > 0 && ijq <= p, Rationalize[phi[[ijq]]], 
       i <= q && ijq == 0, -1, True, 0]]];

Partition[tccf[ar,ma],2]//N//MatrixForm

check

Qapprox=300; (*number of lags, larger better approx*)

?ImpulseCoefficientsARMA

arψ=ImpulseCoefficientsARMA[ar,{},Qapprox];

x1={arψ,PadLeft[arψ,Qapprox+2]//Most};

maψ=ImpulseCoefficientsARMA[ma,{},Qapprox];

x2=-{maψ,PadLeft[maψ,Qapprox+2]//Most};

X=Join[x1,x2]//Transpose;

Transpose[Transpose[X].X]//MatrixForm

which agrees with the result computed using InformationMatrixARMA

(({{5.43`, 4.827`, -0.323`, -0.547`, 0.068`, 0.001`, 0.068`, 0.001`}, {4.827`, 5.43`, 0.454`, -0.323`, 0.096`, 0.001`, 0.096`, 0.001`}, {-0.323`, 0.454`, 3.035`, -2.448`, -0.011`, 0, -0.011`, 0}, {-0.547`, -0.323`, -2.448`, 3.035`, 0.018000000000000002`, 0, 0.018000000000000002`, 0}, {0.068`, 0.096`, -0.011`, 0.018000000000000002`, 1.1360000000000001`, -0.379`, -1.1280000000000001`, 0.37`}, {0.001`, 0.001`, 0, 0, -0.379`, 1.1360000000000001`, 0.314`, -1.1280000000000001`}, {0.068`, 0.096`, -0.011`, 0.018000000000000002`, -1.1280000000000001`, 0.314`, 1.1400000000000001`, -0.3`}, {0.001`, 0.001`, 0, 0, 0.37`, -1.1280000000000001`, -0.3`, 1.1400000000000001`}}))

The required cross-covariances in InformationMatrixARMA were obtained from the tccf function

tccf[ar, ma]//N

Checking result -- (ar, sar)

As in my 1978 JRSS B paper, we define, X, so that X'X≐ℐ, where ℐ is the information matrix. In this illustration I will only compute the block of ℐ corresponding to ar and sar as above. The rest of the computation follows the same principle.

tccf function for seasonal

See eqn. (41).  For ar-sar part we need cross-covariances   (Subscript[γ, vV])(i-j s)

?tccfseasonal

tccfseasonal[phi_, phis_, s_] := Module[{p = Length[phi], ps = Length[phis], c}, If[p == 0 || ps == 0, Return[{}]];
  c = tccf[phi, ExpandToSeasonal[phis, s]];
  Partition[c[[Flatten[Table[p + ps*s - (ii - 1) - (jj - 1)*s - 1, {jj, ps}, {ii, p}] // Transpose // RotateRight]]], ps]]

tccfseasonal[ar,sar,12]//N

check

Qapprox=300; (*number of lags, larger better approx*)

?ImpulseCoefficientsARMA

arψ=ImpulseCoefficientsARMA[ar,{},Qapprox];

Length[arψ]

x1={arψ,PadLeft[arψ,Qapprox+2]//Most};

?ExpandToSeasonal

sarE=ExpandToSeasonal[sar, 12];

sarψ=ImpulseCoefficientsARMA[sarE,{},Qapprox];

x2={sarψ,Take[PadLeft[sarψ,Qapprox+13],Qapprox+1]};

X=Join[x1,x2]//Transpose;

See eqn. (41).  For ar-sar part we need cross-covariances   (Subscript[γ, vV])(i-j s)

Transpose[X].X//MatrixForm

Further checks needed -- Justin can you please check ar-sma, ma-sar, ma-sma?