4.8.10.1.7. statsmodels.tsa.varma_process.vargenerate¶
-
statsmodels.tsa.varma_process.
vargenerate
(ar, u, initvalues=None)[source]¶ generate an VAR process with errors u
similar to gauss uses loop
Parameters: ar : array (nlags,nvars,nvars)
matrix lagpolynomial
u : array (nobs,nvars)
exogenous variable, error term for VAR
Returns: sar : array (1+nobs,nvars)
sample of var process, inverse filtered u does not trim initial condition y_0 = 0
Examples
# generate random sample of VAR nobs, nvars = 10, 2 u = numpy.random.randn(nobs,nvars) a21 = np.array([[[ 1. , 0. ],
[ 0. , 1. ]],- [[-0.8, 0. ],
- [ 0., -0.6]]])
vargenerate(a21,u)
# Impulse Response to an initial shock to the first variable imp = np.zeros((nobs, nvars)) imp[0,0] = 1 vargenerate(a21,imp)