pyeeg.simulate.simulate_var_from_cov

pyeeg.simulate.simulate_var_from_cov(cov, nobs=500, ndim=2, seed=42, verbose=False)

Simulate a VAR model of order order from a covariance matrix.

The VAR model is defined as:

\[x_t = A_1 x_{t-1} + A_2 x_{t-2} + ... + A_p x_{t-p} + \epsilon_t x_t = \sum_{i=1}^p A_i x_{t-i} + \epsilon_t\]

where \(x_t\) is a vector of shape (ndim, 1), \(A_i\) is a matrix of shape (ndim, ndim).

Parameters:
  • cov (array_like) – The covariance matrices of the VAR model. Shape (order, ndim, ndim). The order of the model is inferred from cov.shape[0].

  • nobs (int) – The number of observations to simulate.

  • ndim (int) – The number of dimensions of the VAR process.

  • seed (int) – The random seed used to initialise the process.

  • verbose (bool) – Whether to log information about the simulation.

Returns:

data – The simulated VAR time series. Shape (nobs, ndim).

Return type:

ndarray

Notes

The coefficients at a given lag are such as \(C_ij\) is i->j, so it will be the coefficients for dimension j! For example, each row of the first column are determining the contributions of each component onto the first component.