econmethods 3.0.5__tar.gz → 3.0.5.1__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-3.0.5 → econmethods-3.0.5.1}/PKG-INFO +1 -1
- {econmethods-3.0.5 → econmethods-3.0.5.1}/econmethods/Lib.py +31 -40
- {econmethods-3.0.5 → econmethods-3.0.5.1}/econmethods.egg-info/PKG-INFO +1 -1
- {econmethods-3.0.5 → econmethods-3.0.5.1}/setup.py +1 -1
- {econmethods-3.0.5 → econmethods-3.0.5.1}/README.md +0 -0
- {econmethods-3.0.5 → econmethods-3.0.5.1}/econmethods/CADF_Crit_Values.xlsx +0 -0
- {econmethods-3.0.5 → econmethods-3.0.5.1}/econmethods/__init__.py +0 -0
- {econmethods-3.0.5 → econmethods-3.0.5.1}/econmethods.egg-info/SOURCES.txt +0 -0
- {econmethods-3.0.5 → econmethods-3.0.5.1}/econmethods.egg-info/dependency_links.txt +0 -0
- {econmethods-3.0.5 → econmethods-3.0.5.1}/econmethods.egg-info/requires.txt +0 -0
- {econmethods-3.0.5 → econmethods-3.0.5.1}/econmethods.egg-info/top_level.txt +0 -0
- {econmethods-3.0.5 → econmethods-3.0.5.1}/setup.cfg +0 -0
|
@@ -412,13 +412,14 @@ class FECM:
|
|
|
412
412
|
return means
|
|
413
413
|
|
|
414
414
|
def build_GLS(self, w_err: float) -> np.ndarray:
|
|
415
|
-
re = self.__lr_df.
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
re = self.__lr_df.groupby('region')[self.__lr_df.columns[2:]].mean()
|
|
416
|
+
temp = sm.OLS(re.iloc[:, 2], sm.add_constant(re.iloc[:, 3:])).fit()
|
|
417
|
+
sigma2 = temp.ssr / temp.df_resid
|
|
418
|
+
sigma_u = sigma2 - w_err/self.__T
|
|
418
419
|
if sigma_u <= 0:
|
|
419
420
|
sigma_u = 0
|
|
420
421
|
sig = np.full((self.__T, self.__T), sigma_u)
|
|
421
|
-
np.fill_diagonal(sig,
|
|
422
|
+
np.fill_diagonal(sig, sigma_u+w_err)
|
|
422
423
|
matrix = np.kron(np.eye(self.__N), sig)
|
|
423
424
|
return matrix
|
|
424
425
|
|
|
@@ -460,11 +461,11 @@ class FECM:
|
|
|
460
461
|
else:
|
|
461
462
|
lr_fe = self.build_FE()
|
|
462
463
|
if self.__lr_c:
|
|
463
|
-
resid =
|
|
464
|
+
resid = sm.OLS(lr_fe.loc[:, 'target'], sm.add_constant(lr_fe.iloc[:, 3:])).fit().mse_resid
|
|
464
465
|
lr_re_matrix = self.build_GLS(resid)
|
|
465
466
|
return sm.GLS(self.__lr_df.loc[:, 'target'], sm.add_constant(self.__lr_df.iloc[:, 3:]), lr_re_matrix).fit()
|
|
466
467
|
else:
|
|
467
|
-
resid =
|
|
468
|
+
resid = sm.OLS(lr_fe.loc[:, 'target'], lr_fe.iloc[:, 3:]).fit().mse_resid
|
|
468
469
|
lr_re_matrix = self.build_GLS(resid)
|
|
469
470
|
return sm.GLS(self.__lr_df.loc[:, 'target'], self.__lr_df.iloc[:, 3:], lr_re_matrix).fit()
|
|
470
471
|
|
|
@@ -701,41 +702,31 @@ class CDTwoWay:
|
|
|
701
702
|
print(f'p-value = {pval} < alpha = {self.__alpha}\n There is Significant Cross-Sectional Dependence in your data according to the CD-test. \n Significance level: {self.__alpha*100}%')
|
|
702
703
|
else:
|
|
703
704
|
print(f'p-value = {pval} > alpha = {self.__alpha} There is No Significant Cross-Sectional Dependence in your data according to the CD-test. \n Significance level: {self.__alpha*100}%')
|
|
704
|
-
|
|
705
|
-
|
|
706
705
|
class SlopeHomogeneityF:
|
|
707
706
|
'''
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
<hr>
|
|
732
|
-
<h3><em>Note that this test has got certain assumptions, such as error homoskedasticity, N < T.
|
|
733
|
-
The <FTwoWay> instance will check for these conditions to be met, and will yield an error if they are not.</em></h3>
|
|
734
|
-
<hr>
|
|
735
|
-
<h2>RETURNS:</h2>
|
|
736
|
-
<ol>
|
|
737
|
-
<li>Via the instance.verdict() method - prints the result of the F-test.</li>
|
|
738
|
-
</ol>
|
|
707
|
+
The implementation of the F-test for data slope Homogeneity in panel data.
|
|
708
|
+
---
|
|
709
|
+
Hypotheses:
|
|
710
|
+
---
|
|
711
|
+
+ H0: b_i = b_j given that i != j
|
|
712
|
+
+ H_1: b_i != b_j for at least one such pair of (i, j) that i != j
|
|
713
|
+
---
|
|
714
|
+
PARAMETERS:
|
|
715
|
+
---
|
|
716
|
+
- **df:** a Pandas DataFrame containing panel data. Make sure your data is structured in this exact order (by column index):
|
|
717
|
+
+ 0 - Spatial units. The data must be homogenous, e.g. only cities, contries, regions, etc.
|
|
718
|
+
+ 1 - Temporal units. The data must be homogenous, e.g. only years, months, quarters, etc.
|
|
719
|
+
+ 2 - Your target/endogenous variable. The data must not contain NaN values.
|
|
720
|
+
+ 3+ - Your exogenous variables. The data must not contain NaN values.
|
|
721
|
+
- **level:** Your significance level to test at. Defaults to 5%.
|
|
722
|
+
- **intercept:** Specify whether your model has an intercept. Defaults to True.
|
|
723
|
+
- **skip_premise:** Set to True if you wish to ignore heteroskedasticity. Not a recommended option, parameter defaults to False
|
|
724
|
+
*Note that this test has got certain assumptions, such as error homoskedasticity, N < T.
|
|
725
|
+
The <FTwoWay> instance will check for these conditions to be met, and will yield an error if they are not.*
|
|
726
|
+
---
|
|
727
|
+
**RETURNS:**
|
|
728
|
+
|
|
729
|
+
+ Via the instance.verdict() method - prints the result of the F-test.
|
|
739
730
|
'''
|
|
740
731
|
def __init__(self, df: pd.DataFrame, level: int = 5, intercept: bool = True, skip_premise: bool = False) -> None:
|
|
741
732
|
self.__df = df
|
|
@@ -787,4 +778,4 @@ class SlopeHomogeneityF:
|
|
|
787
778
|
|
|
788
779
|
def __del__(self) -> None:
|
|
789
780
|
pass
|
|
790
|
-
|
|
781
|
+
|
|
@@ -5,7 +5,7 @@ with open('README.md', 'r') as f:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name = 'econmethods',
|
|
8
|
-
version = 'v3.0.5',
|
|
8
|
+
version = 'v3.0.5.1',
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|