You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My code
aic, bic, fpe, hqic = [], [], [], []
model = VAR(CRTA_train)
p = np.arange(1,60)
for i in p:
result = model.fit(i)
aic.append(result.aic)
bic.append(result.bic)
fpe.append(result.fpe)
hqic.append(result.hqic)
lags_metrics_df = pd.DataFrame({'AIC': aic,
'BIC': bic,
'HQIC': hqic,
'FPE': fpe},
index=p)
fig, ax = plt.subplots(1, 4, figsize=(15, 3), sharex=True)
lags_metrics_df.plot(subplots=True, ax=ax, marker='o')
plt.tight_layout()
my error:
AttributeError Traceback (most recent call last)
AttributeError: 'float' object has no attribute 'sqrt'
The above exception was the direct cause of the following exception:
TypeError Traceback (most recent call last)
Cell In[101], line 5
3 p = np.arange(1,60)
4 for i in p:
----> 5 result = model.fit(i)
6 aic.append(result.aic)
7 bic.append(result.bic)
My code
aic, bic, fpe, hqic = [], [], [], []
model = VAR(CRTA_train)
p = np.arange(1,60)
for i in p:
result = model.fit(i)
aic.append(result.aic)
bic.append(result.bic)
fpe.append(result.fpe)
hqic.append(result.hqic)
lags_metrics_df = pd.DataFrame({'AIC': aic,
'BIC': bic,
'HQIC': hqic,
'FPE': fpe},
index=p)
fig, ax = plt.subplots(1, 4, figsize=(15, 3), sharex=True)
lags_metrics_df.plot(subplots=True, ax=ax, marker='o')
plt.tight_layout()
my error:
AttributeError Traceback (most recent call last)
AttributeError: 'float' object has no attribute 'sqrt'
The above exception was the direct cause of the following exception:
TypeError Traceback (most recent call last)
Cell In[101], line 5
3 p = np.arange(1,60)
4 for i in p:
----> 5 result = model.fit(i)
6 aic.append(result.aic)
7 bic.append(result.bic)
File ~/anaconda3/lib/python3.11/site-packages/statsmodels/tsa/vector_ar/var_model.py:695, in VAR.fit(self, maxlags, method, ic, trend, verbose)
687 self.data.xnames = (
688 self.data.xnames[:k_trend]
689 + x_names_to_add
690 + self.data.xnames[k_trend:]
691 )
692 self.data.cov_names = pd.MultiIndex.from_product(
693 (self.data.xnames, self.data.ynames)
694 )
--> 695 return self._estimate_var(lags, trend=trend)
File ~/anaconda3/lib/python3.11/site-packages/statsmodels/tsa/vector_ar/var_model.py:738, in VAR._estimate_var(self, lags, offset, trend)
736 z[:, i] += lags
737 # make the same adjustment for the quadratic term
--> 738 if (np.diff(np.sqrt(z[:, i])) == 1).all():
739 z[:, i] = (np.sqrt(z[:, i]) + lags) ** 2
741 y_sample = endog[lags:]
TypeError: loop of ufunc does not support argument 0 of type float which has no callable sqrt method
The text was updated successfully, but these errors were encountered: