econmethods 3.0.5.3__tar.gz → 3.0.5.4__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: 3.0.5.3
3
+ Version: 3.0.5.4
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
@@ -232,31 +232,31 @@ class HausmanOneWay:
232
232
 
233
233
  def build_FE(self) -> pd.DataFrame:
234
234
  fe = self.__df.copy(deep=True)
235
- for i, unit in enumerate(self.__df.SpUnit.unique()[1:]):
235
+ for i, unit in enumerate(self.__df.SpUnit.unique()):
236
236
  fe.loc[:, f'd{i}'] = np.where(fe.SpUnit == unit, 1, 0)
237
237
  return fe.iloc[:, 2:]
238
238
 
239
239
  def build_GLS(self, w_err: float) -> pd.DataFrame | None:
240
- re = self.__df.copy(deep=True)
241
- sigma2 = np.sum((sm.OLS(re.iloc[:, 2], sm.add_constant(re.iloc[:, 3:])).fit()).resid**2) / (self.__N*self.__T - self.__exog)
242
- sigma_u = sigma2 - w_err
240
+ re = self.__lr_df.groupby('SpUnit')[self.__lr_df.columns[2:]].mean()
241
+ temp = sm.OLS(re.iloc[:, 0], sm.add_constant(re.iloc[:, 1:])).fit()
242
+ sigma2 = temp.ssr / temp.df_resid
243
+ sigma_u = sigma2 - w_err/self.__T
243
244
  if sigma_u <= 0:
244
245
  sigma_u = 0
245
246
  elif sigma_u > 0:
246
247
  if not self.__fgls:
247
- self.__RE = 'MLE'
248
+ self.__RE = 'REML'
248
249
  return None
249
250
  sig = np.full((self.__T, self.__T), sigma_u)
250
- np.fill_diagonal(sig, sigma2)
251
+ np.fill_diagonal(sig, sigma_u+w_err)
251
252
  matrix = np.kron(np.eye(self.__N), sig)
252
253
  return matrix
253
-
254
-
254
+
255
255
  def estimate(self) -> float:
256
256
  fe_df = self.build_FE()
257
257
  Chi = 0
258
- fe_res = sm.OLS(fe_df.iloc[:, 0], sm.add_constant(fe_df.iloc[:, 1:])).fit()
259
- matrix = self.build_GLS(np.sum(fe_res.resid**2) / (self.__N*(self.__T-1) - self.__exog))
258
+ fe_res = sm.OLS(fe_df.iloc[:, 0], fe_df.iloc[:, 1:]).fit()
259
+ matrix = self.build_GLS(fe_res.mse_resid)
260
260
  if matrix is not None:
261
261
  re_res = sm.GLS(self.__df.iloc[:, 2], sm.add_constant(self.__df.iloc[:, 3:]), matrix).fit()
262
262
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: econmethods
3
- Version: 3.0.5.3
3
+ Version: 3.0.5.4
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 = 'v3.0.5.3',
8
+ version = 'v3.0.5.4',
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