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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: econmethods
3
- Version: 2.8
3
+ Version: 2.9
4
4
  Summary: A python package implementing various econometrical tests and estimators
5
5
  Home-page: https://github.com/NaturionBG/econmethods
6
6
  Author: NaturionBG
@@ -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
- while True:
514
- flag = True
515
- if max(zip(est[0].params.index, est[0].pvalues), key=lambda x: x[1])[1] > 0.06:
516
- pool = pool.drop(columns=[max(zip(est[0].params.index, est[0].pvalues), key=lambda x: x[1])[0]])
517
- flag=False
518
- if flag:
519
- break
520
- else:
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
- est[0] = sm.OLS(pool['target_diff'], pool.iloc[:, 3:]).fit()
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
- while True:
558
- flag = True
559
- if max(zip(res['coefs'].index, res['coefs']['T-pvalues']), key=lambda x: x[1])[1] > 0.06:
560
- self.__sr = self.build_sr([max(zip(res['coefs'].index, res['coefs']['T-pvalues']), key=lambda x: x[1])[0]])
561
- flag=False
562
- if flag:
563
- break
564
- else:
565
- res = self.mg_algorithm()
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: econmethods
3
- Version: 2.8
3
+ Version: 2.9
4
4
  Summary: A python package implementing various econometrical tests and estimators
5
5
  Home-page: https://github.com/NaturionBG/econmethods
6
6
  Author: NaturionBG
@@ -5,7 +5,7 @@ with open('README.md', 'r') as f:
5
5
 
6
6
  setup(
7
7
  name = 'econmethods',
8
- version = 'v2.8',
8
+ version = 'v2.9',
9
9
  description='A python package implementing various econometrical tests and estimators',
10
10
  packages = find_packages(),
11
11
  long_description=long_desc,
File without changes
File without changes