From 353fd077d1e5db0f89bd8e9bb9b9206175a45128 Mon Sep 17 00:00:00 2001 From: Ian Date: Sun, 15 Oct 2023 16:32:12 +0200 Subject: [PATCH] Fixed issue with regARMA where the setup breaks if multiple regressors are added --- .gitignore | 3 +++ armagarch/regARMA.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7a4c971..8da8b7b 100644 --- a/.gitignore +++ b/.gitignore @@ -49,5 +49,8 @@ coverage.xml *.log *.pot +# pip +.pypirc + # Sphinx documentation docs/_build/ \ No newline at end of file diff --git a/armagarch/regARMA.py b/armagarch/regARMA.py index c02089b..8b9eea0 100644 --- a/armagarch/regARMA.py +++ b/armagarch/regARMA.py @@ -51,7 +51,7 @@ def _getStartingVals(self): # get starting values from ARMA model self._startingValues = self._coreARMA._startingValues # add starting values for the regressors from OLS - X = np.array([np.ones(len(self._regs)), np.reshape(self._regs.values,(len(self._regs),))]).T + X = np.concatenate([np.ones((self._regs.shape[0],1)), self._regs], axis=1) Y = self._data.values beta = np.linalg.inv(X.T@X)@X.T@Y self._startingValues = np.concatenate((self._startingValues,np.reshape(beta[1:],(len(beta[1:]),))))