UDST / choicemodels

Python library for discrete choice modeling
https://udst.github.io/choicemodels
BSD 3-Clause "New" or "Revised" License
74 stars 33 forks source link

Add more test statistics to the MNL summary table #28

Closed smmaurer closed 6 years ago

smmaurer commented 6 years ago

The summary table for estimation results from the native 'ChoiceModels' estimator is missing a lot of things:

                  CHOICEMODELS ESTIMATION RESULTS                  
===================================================================
Dep. Var.:                chosen   No. Observations:               
Model:         Multinomial Logit   Df Residuals:                   
Method:       Maximum Likelihood   Df Model:                       
Date:                              Pseudo R-squ.:                  
Time:                              Pseudo R-bar-squ.:              
AIC:                               Log-Likelihood:       -1,850.771
BIC:                               LL-Null:              -3,211.771
==========================================================================
                           coef   std err         z     P>|z|   Conf. Int.
--------------------------------------------------------------------------
res_price_per_sqft      -0.9158     0.041   -22.557                       
population              -3.2580     0.187   -17.389                       
ave_income_500:income   -0.1176     0.002   -55.188                       
job_500                  0.0418     0.010     4.169                       
renters                  2.3650     0.200    11.851                       
==========================================================================

Top priorities to add are number of observations, p-values, and r-squared, I think, with others as needed or if they are easy?

The existing test statistics come from the mnl_estimate() function (mnl.py#L612), which we haven't done any refactoring of yet, just wrapped with the MultinomialLogit() class.

The summary table is generated here: mnl.py#L338, with the content and format inspired by PyLogit and StatsModels -- but we can adapt it to display whatever we want.

To fill in more fields, we can calculate them here and pass them to the summary_table() function: mnl.py#L313