Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scot/var.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def fit(self, data):
# regularized least squares (ridge regression)
x, y = self._construct_eqns_rls(data)

b, res, rank, s = sp.linalg.lstsq(x, y)
b, res, rank, s = np.linalg.lstsq(x, y)

self.coef = b.transpose()

Expand Down
6 changes: 3 additions & 3 deletions scot/varbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,22 +340,22 @@ def _construct_eqns(self, data):
def _construct_var_eqns(data, p, delta=None):
"""Construct VAR equation system (optionally with RLS constraint).
"""
t, m, l = np.shape(data)
t, l, m = np.shape(data)
n = (l - p) * t # number of linear relations
rows = n if delta is None else n + m * p

# Construct matrix x (predictor variables)
x = np.zeros((rows, m * p))
for i in range(m):
for k in range(1, p + 1):
x[:n, i * p + k - 1] = np.reshape(data[:, i, p - k:-k].T, n)
x[:n, i * p + k - 1] = np.reshape(data[:, p - k:-k, i], n)
if delta is not None:
np.fill_diagonal(x[n:, :], delta)

# Construct vectors yi (response variables for each channel i)
y = np.zeros((rows, m))
for i in range(m):
y[:n, i] = np.reshape(data[:, i, p:].T, n)
y[:n, i] = np.reshape(data[:, p:, i], n)

return x, y

Expand Down
Loading