varCompanion#

Purpose#

Extract the companion matrix and stability diagnostics from a fitted VAR or BVAR model.

Format#

{ companion, eigenvalues, is_stable } = varCompanion(result)#
Parameters:

result (struct) – an instance of a varResult or bvarResult structure.

Returns:
  • companion (matrix) – (mp)x(mp) companion matrix.

  • eigenvalues (matrix) – (mp)x2 matrix with columns [real, imaginary] for each eigenvalue.

  • is_stable (scalar) – 1 if all eigenvalues are inside the unit circle, 0 otherwise.

Examples#

new;
library timeseries;

data = loadd(getGAUSSHome("pkgs/timeseries/examples/macro.dat"));
result = varFit(data, 4, quiet=1);

// Extract companion matrix and eigenvalues
{ companion, eigenvalues, is_stable } = varCompanion(result);

if is_stable;
    print "VAR is stable.";
else;
    print "WARNING: VAR is not stable.";
endif;

// Eigenvalue moduli
moduli = sqrt(eigenvalues[., 1]^2 + eigenvalues[., 2]^2);
print "Eigenvalue moduli:";
print moduli;

Library#

timeseries

Source#

var.src

See also

Functions varFit(), bvarFit()