econmethods 2.9__tar.gz → 3__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.9
3
+ Version: 3
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
@@ -278,7 +278,6 @@ class HausmanOneWay:
278
278
  def __del__(self) -> None:
279
279
  pass
280
280
 
281
-
282
281
  class FECM:
283
282
  '''
284
283
  The implementation of a first-order ECM (Error Correction Model) estimation for panel data.
@@ -329,6 +328,7 @@ class FECM:
329
328
  self.__autorem = autorem
330
329
  self.__C = intercept
331
330
  self.__lag = n_lags
331
+ self.x_difs = []
332
332
  self.__method = method.lower()
333
333
  self.__exog = len(df.columns[3:])
334
334
  self.__l =[]
@@ -342,6 +342,7 @@ class FECM:
342
342
  self.__stat_vars.columns = ['SpUnit', 'time'] + self.__stat
343
343
  for i in range(1, self.__exog+1):
344
344
  self.__l.append(f'x{i}')
345
+ self.x_difs.append(f'x{i}_diff')
345
346
  self.__mean_names.append(f'x{i}_avg')
346
347
  self.__df.columns = ['SpUnit', 'time', 'target'] + self.__l
347
348
  if isinstance(coint, list):
@@ -514,11 +515,20 @@ class FECM:
514
515
  est.append(sm.OLS(pool['target_diff'], pool.iloc[:, 3:]).fit())
515
516
  if self.__autorem:
516
517
  while True:
518
+ ts = []
517
519
  flag = True
518
520
  if max(zip(est[0].params.index, est[0].pvalues), key=lambda x: x[1])[1] > 0.06:
519
521
  pool = pool.drop(columns=[max(zip(est[0].params.index, est[0].pvalues), key=lambda x: x[1])[0]])
520
522
  flag=False
521
- if flag:
523
+ for i in self.x_difs:
524
+ try:
525
+ tmp = est[0].pvalues[i] <= 0.05
526
+ if tmp:
527
+ ts.append(1)
528
+ except Exception:
529
+ ts.append(1)
530
+
531
+ if flag or len(ts) == len(self.x_difs):
522
532
  break
523
533
  else:
524
534
  if self.__C:
@@ -559,11 +569,19 @@ class FECM:
559
569
  res = self.mg_algorithm()
560
570
  if self.__autorem:
561
571
  while True:
572
+ ts = []
562
573
  flag = True
563
574
  if max(zip(res['coefs'].index, res['coefs']['T-pvalues']), key=lambda x: x[1])[1] > 0.06:
564
575
  self.__sr = self.build_sr([max(zip(res['coefs'].index, res['coefs']['T-pvalues']), key=lambda x: x[1])[0]])
565
576
  flag=False
566
- if flag:
577
+ for i in self.x_difs:
578
+ try:
579
+ tmp = res['coefs']['T-pvalues'][i] <= 0.05
580
+ if tmp:
581
+ ts.append(1)
582
+ except Exception:
583
+ ts.append(1)
584
+ if flag or len(ts) == len(self.x_difs):
567
585
  break
568
586
  else:
569
587
  res = self.mg_algorithm()
@@ -573,10 +591,6 @@ class FECM:
573
591
 
574
592
  def __del__(self) -> None:
575
593
  pass
576
-
577
-
578
-
579
-
580
594
  class CDTwoWay:
581
595
  '''
582
596
  Implementation of the CD test to validate/reject cross-sectional dependence.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: econmethods
3
- Version: 2.9
3
+ Version: 3
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.9',
8
+ version = 'v3',
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