Learn R Programming

simStateSpace (version 1.2.15)

ProjectToStability: Project Matrix to Stability

Description

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)

Value

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

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).

Author

Ivan Jacob Agaloos Pesigan

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.

See Also

Other Simulation of State Space Models Data Functions: LinSDE2SSM(), LinSDECovEta(), LinSDECovY(), LinSDEMeanEta(), LinSDEMeanY(), ProjectToHurwitz(), SSMCovEta(), SSMCovY(), SSMInterceptEta(), SSMInterceptY(), SSMMeanEta(), SSMMeanY(), SimAlphaN(), SimBetaN(), SimBetaN2(), SimBetaNCovariate(), SimCovDiagN(), SimCovN(), SimIotaN(), SimNuN(), SimPhiN(), SimPhiN2(), SimPhiNCovariate(), SimSSMFixed(), SimSSMIVary(), SimSSMLinGrowth(), SimSSMLinGrowthIVary(), SimSSMLinSDEFixed(), SimSSMLinSDEIVary(), SimSSMOUFixed(), SimSSMOUIVary(), SimSSMVARFixed(), SimSSMVARIVary(), SpectralRadius(), TestPhi(), TestPhiHurwitz(), TestStability(), TestStationarity()

Examples

Run this code
# Matrix with eigenvalues greater than 1
x <- matrix(
  data = c(
    1.2, 0.3,
    0.4, 0.9
  ),
  nrow = 2
)
SpectralRadius(x = x) # > 1
SpectralRadius(x = ProjectToStability(x = x))  # < 1

# 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)

Run the code above in your browser using DataLab