def _var_acf(coefs, sig_u): """ Compute autocovariance function ACF_y(h) for h=1,...,p Notes ----- Lutkepohl (2005) p.29 """ p, k, k2 = coefs.shape assert(k == k2) A = util.comp_matrix(coefs) # construct VAR(1) noise covariance SigU = np.zeros((k*p, k*p)) SigU[:k,:k] = sig_u # vec(ACF) = (I_(kp)^2 - kron(A, A))^-1 vec(Sigma_U) vecACF = L.solve(np.eye((k*p)**2) - np.kron(A, A), vec(SigU)) acf = unvec(vecACF) acf = acf[:k].T.reshape((p, k, k)) return acf
def _var_acf(coefs, sig_u): """ Compute autocovariance function ACF_y(h) for h=1,...,p Notes ----- Lutkepohl (2005) p.29 """ p, k, k2 = coefs.shape assert (k == k2) A = util.comp_matrix(coefs) # construct VAR(1) noise covariance SigU = np.zeros((k * p, k * p)) SigU[:k, :k] = sig_u # vec(ACF) = (I_(kp)^2 - kron(A, A))^-1 vec(Sigma_U) vecACF = L.solve(np.eye((k * p)**2) - np.kron(A, A), vec(SigU)) acf = unvec(vecACF) acf = acf[:k].T.reshape((p, k, k)) return acf
def lr_effect_stderr(self, orth=False): cov = self.lr_effect_cov(orth=orth) return tsa.unvec(np.sqrt(np.diag(cov)))
def cum_effect_stderr(self, orth=False): return np.array([tsa.unvec(np.sqrt(np.diag(c))) for c in self.cum_effect_cov(orth=orth)])