econmethods 2.8__tar.gz → 2.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {econmethods-2.8 → econmethods-2.9}/PKG-INFO +1 -1
- {econmethods-2.8 → econmethods-2.9}/econmethods/Lib.py +25 -21
- {econmethods-2.8 → econmethods-2.9}/econmethods.egg-info/PKG-INFO +1 -1
- {econmethods-2.8 → econmethods-2.9}/setup.py +1 -1
- {econmethods-2.8 → econmethods-2.9}/README.md +0 -0
- {econmethods-2.8 → econmethods-2.9}/econmethods/CADF_Crit_Values.xlsx +0 -0
- {econmethods-2.8 → econmethods-2.9}/econmethods/__init__.py +0 -0
- {econmethods-2.8 → econmethods-2.9}/econmethods.egg-info/SOURCES.txt +0 -0
- {econmethods-2.8 → econmethods-2.9}/econmethods.egg-info/dependency_links.txt +0 -0
- {econmethods-2.8 → econmethods-2.9}/econmethods.egg-info/requires.txt +0 -0
- {econmethods-2.8 → econmethods-2.9}/econmethods.egg-info/top_level.txt +0 -0
- {econmethods-2.8 → econmethods-2.9}/setup.cfg +0 -0
|
@@ -312,6 +312,7 @@ class FECM:
|
|
|
312
312
|
- *intercept*: Specify whether the ECM model should have an intercept. Defaults to True.
|
|
313
313
|
- *stat_vars*: a DataFrame of the same format as "df" - includes variables that will not be differenced and included into the ECM in their raw form. Ensure these variables are I(0). Defaults to None.
|
|
314
314
|
- *lr_const*: Specify whether the long-run model should have a constant.
|
|
315
|
+
- *autorem*: Enables/Disables automatic removal of insignificant regression coefficients in the ECM. Defaults to True.
|
|
315
316
|
----
|
|
316
317
|
RETURNS:
|
|
317
318
|
--
|
|
@@ -321,10 +322,11 @@ class FECM:
|
|
|
321
322
|
If a CCE- method is chosen:
|
|
322
323
|
- The AR(d) estimation results to forecast the cross-sectional mean | key = "ar"
|
|
323
324
|
'''
|
|
324
|
-
def __init__(self, df: pd.DataFrame, effects: str = 'rand', trend: int = 0, n_lags: int = 1, method: str = 'MG', coint: str | list[str] = 'x1', intercept: bool = True, stat_vars: pd.DataFrame|None = None, lr_const: bool = False) -> None:
|
|
325
|
+
def __init__(self, df: pd.DataFrame, effects: str = 'rand', trend: int = 0, n_lags: int = 1, method: str = 'MG', coint: str | list[str] = 'x1', intercept: bool = True, stat_vars: pd.DataFrame|None = None, lr_const: bool = False, autorem: bool = True) -> None:
|
|
325
326
|
self.__df = df
|
|
326
327
|
self.__eff = effects.lower()
|
|
327
328
|
self.__t = trend
|
|
329
|
+
self.__autorem = autorem
|
|
328
330
|
self.__C = intercept
|
|
329
331
|
self.__lag = n_lags
|
|
330
332
|
self.__method = method.lower()
|
|
@@ -510,18 +512,19 @@ class FECM:
|
|
|
510
512
|
est.append(sm.OLS(pool['target_diff'], sm.add_constant(pool.iloc[:, 3:])).fit())
|
|
511
513
|
else:
|
|
512
514
|
est.append(sm.OLS(pool['target_diff'], pool.iloc[:, 3:]).fit())
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
if self.__C:
|
|
522
|
-
est[0] = sm.OLS(pool['target_diff'], sm.add_constant(pool.iloc[:, 3:])).fit()
|
|
515
|
+
if self.__autorem:
|
|
516
|
+
while True:
|
|
517
|
+
flag = True
|
|
518
|
+
if max(zip(est[0].params.index, est[0].pvalues), key=lambda x: x[1])[1] > 0.06:
|
|
519
|
+
pool = pool.drop(columns=[max(zip(est[0].params.index, est[0].pvalues), key=lambda x: x[1])[0]])
|
|
520
|
+
flag=False
|
|
521
|
+
if flag:
|
|
522
|
+
break
|
|
523
523
|
else:
|
|
524
|
-
|
|
524
|
+
if self.__C:
|
|
525
|
+
est[0] = sm.OLS(pool['target_diff'], sm.add_constant(pool.iloc[:, 3:])).fit()
|
|
526
|
+
else:
|
|
527
|
+
est[0] = sm.OLS(pool['target_diff'], pool.iloc[:, 3:]).fit()
|
|
525
528
|
return est
|
|
526
529
|
|
|
527
530
|
def mg_algorithm(self) -> pd.DataFrame:
|
|
@@ -554,15 +557,16 @@ class FECM:
|
|
|
554
557
|
elif self.__method == 'ccemg' or self.__method == 'mg':
|
|
555
558
|
dct['lr_res'] = self.__lr
|
|
556
559
|
res = self.mg_algorithm()
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
560
|
+
if self.__autorem:
|
|
561
|
+
while True:
|
|
562
|
+
flag = True
|
|
563
|
+
if max(zip(res['coefs'].index, res['coefs']['T-pvalues']), key=lambda x: x[1])[1] > 0.06:
|
|
564
|
+
self.__sr = self.build_sr([max(zip(res['coefs'].index, res['coefs']['T-pvalues']), key=lambda x: x[1])[0]])
|
|
565
|
+
flag=False
|
|
566
|
+
if flag:
|
|
567
|
+
break
|
|
568
|
+
else:
|
|
569
|
+
res = self.mg_algorithm()
|
|
566
570
|
|
|
567
571
|
dct['sr_res'] = res
|
|
568
572
|
return dct
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|