metacountregressor 0.1.208__py3-none-any.whl → 0.1.209__py3-none-any.whl

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.
@@ -501,7 +501,7 @@ class ObjectiveFunction(object):
501
501
  # model specs
502
502
  self.endog = None
503
503
  # solution parameters
504
- self._min_characteristics = 1
504
+ self._min_characteristics = kwargs.get('_min_vars', 3)
505
505
  self._max_hurdle = 4
506
506
 
507
507
  #Manually fit from analyst specification
@@ -1408,16 +1408,47 @@ class ObjectiveFunction(object):
1408
1408
 
1409
1409
  return transform_set
1410
1410
 
1411
+
1411
1412
  def poisson_mean_get_dispersion(self, betas, X, y):
1413
+ '''
1412
1414
  eVy = self._loglik_gradient(betas, X, y, None, X, None, None, False, False, dispersion=0,
1413
1415
  return_EV=True,
1414
1416
  zi_list=None, draws_grouped=None, Xgroup=None)
1415
1417
 
1416
- ab = ((y - eVy)**2 - eVy)/eVy
1417
- bb = eVy -1
1418
- disp = sm.OLS(ab.ravel(), bb.ravel()).fit()
1419
- gamma = disp.params[0]
1418
+ print('trying thi instead')
1419
+
1420
+ '''
1421
+
1422
+ '''
1423
+ nb_model = sm.GLM(y_long, x_long, family=sm.families.NegativeBinomial()).fit()
1424
+ gamma = nb_model.scale
1425
+
1426
+ '''
1427
+ #poisson way
1428
+ try:
1429
+ num_panels, num_obs, num_features = X.shape # Dimensions of x
1430
+ x_long = X.reshape(-1, num_features) # Reshape to (num_panels * num_obs, num_features)
1431
+ y_long = y.reshape(-1)
1432
+ poisson_model = sm.GLM(y_long, x_long, family=sm.families.Poisson()).fit()
1433
+
1434
+ # Get residual deviance and degrees of freedom
1435
+ residual_deviance = poisson_model.deviance
1436
+ degrees_of_freedom = poisson_model.df_resid
1437
+
1438
+ # Calculate dispersion
1439
+ dispersion = residual_deviance / degrees_of_freedom
1440
+ except:
1441
+ dispersion =1
1442
+
1443
+ #ab = np.abs(((y - eVy)**2 - eVy)/eVy)
1444
+
1445
+ #bb = eVy -1
1446
+ #disp = sm.OLS(ab.ravel(), bb.ravel()).fit()
1447
+ #gamma = disp.params[0]
1420
1448
  #print(f'dispersion is {gamma}')
1449
+ gamma = np.min(dispersion,1)
1450
+ if gamma < 0.05:
1451
+ gamma = 0.05
1421
1452
  return gamma
1422
1453
 
1423
1454
  def validation(self, betas, y, X, Xr=None, dispersion=0, rdm_cor_fit=None, zi_list=None, exog_infl=None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metacountregressor
3
- Version: 0.1.208
3
+ Version: 0.1.209
4
4
  Summary: Extensive Testing for Estimation of Data Count Models
5
5
  Home-page: https://github.com/zahern/CountDataEstimation
6
6
  Author: Zeke Ahern
@@ -11,10 +11,10 @@ metacountregressor/pareto_file.py,sha256=whySaoPAUWYjyI8zo0hwAOa3rFk6SIUlHSpqZiL
11
11
  metacountregressor/pareto_logger__plot.py,sha256=mEU2QN4wmsM7t39GJ_XhJ_jjsdl09JOmG0U2jICrAkI,30037
12
12
  metacountregressor/setup.py,sha256=5UcQCCLR8Fm5odA3MX78WwahavxFq4mVD6oq0IuQvAY,936
13
13
  metacountregressor/single_objective_finder.py,sha256=jVG7GJBqzSP4_riYr-kMMKy_LE3SlGmKMunNhHYxgRg,8011
14
- metacountregressor/solution.py,sha256=CK4XJivxa-BQPAh-E48ibfRV-7jYwtAt4Bsw1wiRso8,283632
14
+ metacountregressor/solution.py,sha256=9bPdfwyxUx-4Z2EsOheCsTXbksdPd5oC-o4fx_rDhNE,284645
15
15
  metacountregressor/test_generated_paper2.py,sha256=pwOoRzl1jJIIOUAAvbkT6HmmTQ81mwpsshn9SLdKOg8,3927
16
- metacountregressor-0.1.208.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
- metacountregressor-0.1.208.dist-info/METADATA,sha256=W9Uk5kq-SkU_Lo_y7g695BPbHkI0iT1Fcd5-KQJ-hgg,23536
18
- metacountregressor-0.1.208.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
19
- metacountregressor-0.1.208.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
- metacountregressor-0.1.208.dist-info/RECORD,,
16
+ metacountregressor-0.1.209.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
+ metacountregressor-0.1.209.dist-info/METADATA,sha256=VTXXMO16oHNwdRfj4gslq4CBPvRHnD3Ro2HGHIG7xH0,23536
18
+ metacountregressor-0.1.209.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
19
+ metacountregressor-0.1.209.dist-info/top_level.txt,sha256=zGG7UC5WIpr76gsFUpwJ4En2aCcoNTONBaS3OewwjR0,19
20
+ metacountregressor-0.1.209.dist-info/RECORD,,