TrenchInv Testing

Load package

<< TrenchInverse.m

Matrix Inverse

?TrenchInverse

?toe

n = 100 ;phi1 = 0.8 ;c = 
        phi1^Range[0, n - 1]/(1 - phi1^2) ;  (* 
      autocovariance function of AR (1) with parameter phi1 *)

g  =  toe[c];

gi = TrenchInverse[g];

Max[Abs[Flatten[gi - Inverse[g]]]]

The maximum absolute error is very small so we conclude TrenchInverse is working.

Loglikelihood Computation

SeedRandom[231417]; n = 100; phi1 = 0.6;

z = Table[Random[] - 0.5, {n}];

c = phi1^Range[0, n - 1]/(1 - phi1^2) ;  (* 
      autocovariance function of AR (1) with parameter phi1 *)

?TrenchLoglikelihood

TrenchLoglikelihood[c, z]

?DLLoglikelihood

DLLoglikelihood[c, z]

fGN estimation functions

<< FGN.m

Table[FGNAcf[k, 0.7], {k, 1, 20}]

y = Table[Random[] - 0.5, {100}];

FGNLL[0.3, y]

FitFGN[y, MeanZeroQ -> False]

X = StepIAXMatrix[100, 50];

Timing[FitRegressionFGN[ X,  y]]