Skip to contents

Scales a square matrix so that its spectral radius is strictly less than 1 by a specified stability margin. This is useful for ensuring that transition matrices in state space or vector autoregressive (VAR) models are stationary. If the matrix is already within the margin, it is returned unchanged.

Usage

ProjectToStability(x, margin = 0.98, tol = 1e-12)

Arguments

x

Numeric square matrix.

margin

Double in \((0, 1)\). Target upper bound for the spectral radius (default = 0.98).

tol

Small positive double added to the denominator in the scaling factor to avoid division by zero (default 1e-12).

Value

A numeric matrix of the same dimensions as x, scaled if necessary to satisfy the stability constraint.

Details

The projection is performed by multiplying the matrix by a constant factor \(c = \frac{\text{margin}}{\rho + \text{tol}}\), where \(\rho\) is the spectral radius and tol is a small positive number to prevent division by zero.

Author

Ivan Jacob Agaloos Pesigan

Examples

# Matrix with eigenvalues greater than 1
x <- matrix(
  data = c(
    1.2, 0.3,
    0.4, 0.9
  ),
  nrow = 2
)
SpectralRadius(x = x) # > 1
#> [1] 1.427492
SpectralRadius(x = ProjectToStability(x = x))  # < 1
#> [1] 0.98

# Matrix already stable is returned unchanged
x <- matrix(
  data = c(
    0.5, 0.3,
    0.2, 0.4
  ),
  nrow = 2
)
identical(ProjectToStability(x = x), x)
#> [1] TRUE