Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Dcm logit rebased2 #8120

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

josef-pkt
Copy link
Member

rebased version of #1605
no additional changes

no merge conflicts, but likely outdated in inherited parts, no changes in PR since 2014

(I'm not planning to work on this soon, but want to have it closer to current code and wanted to see if there are serious merge conflicts)

AnaMP and others added 30 commits February 14, 2022 12:49
 *  first draft of CLogit based on TryCLogit(sandbox-statsmodels:runmnl.py)
 * add df_model and df_ resid.
 * add summary.
 * deal with names and number of exogs.
 * add 2 examples: one alternative specific varible with and without alternative-specific constants.
 * some clean.
 * first draft of results class.
 * added analytical score/gradient, hessian and Jacobian.
 * examples moved to another file.
 * fixed default method to Newton: solves the problem of high iterations.
 * new value of z: allows estimate alternative specific variables + individual specific variables (new example 4).
 * start params estimated from the standard logit,
 * data entry by dictionary, data handle inside class,
 * work with alternative specific and/or individual/case specific variables.
 * new in summary: method, iterations, elapsed time, num. cases,
        num. and frequencies of alternatives.

Note than from previous commit, when a specific alternative
variable isn't present on all utilities, no longer need to do
previous work like:
  df ['vrble_alternative'] = df ['variable'] * (choice_index == 0)
 * new on summary: LL-Null, Pseudo R-squ., LLR p-value, Likelihood ratio test, AIC.
 * added fitted_values.
…lete prints inside classes.

 * New tests: bse, llf, llnull, aic.
for params, results cross check with biogeme, new tests for
Likelihood ratio test, score and predic values.
…rent from the optimum.

Load forgotten files in last commit: clogit_predict.csv and Biogeme results.
…fied, prediction table.

 * added notes for marginal effect.
 * specification random Coefficients.
 * simulated maximum likelihood.
 * fixed and/or random coefficients.
 * replicate R results (with mean and sd fixed)
…mation procedure.

 * added examples with generic and alternative specific coef.
 * tested against R: more slow but good results.
@pep8speaks
Copy link

Hello @josef-pkt! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 76:32: E711 comparison to None should be 'if cond is None:'

Line 20:1: F401 'pandas as pd' imported but unused
Line 122:15: E271 multiple spaces after keyword
Line 185:15: E271 multiple spaces after keyword
Line 421:19: E711 comparison to None should be 'if cond is None:'
Line 469:23: E124 closing bracket does not match visual indentation

Line 31:68: W605 invalid escape sequence '\s'
Line 33:40: W605 invalid escape sequence '\s'
Line 126:41: W605 invalid escape sequence '\g'
Line 130:15: W605 invalid escape sequence '\q'
Line 130:36: W605 invalid escape sequence '\s'
Line 147:11: E271 multiple spaces after keyword
Line 234:28: W605 invalid escape sequence '\i'
Line 234:66: W605 invalid escape sequence '\i'
Line 234:96: W605 invalid escape sequence '\s'
Line 236:20: W605 invalid escape sequence '\p'
Line 239:28: W605 invalid escape sequence '\i'
Line 239:58: W605 invalid escape sequence '\s'
Line 239:83: W605 invalid escape sequence '\p'
Line 246:15: E271 multiple spaces after keyword
Line 258:17: E117 over-indented
Line 298:46: W605 invalid escape sequence '\s'
Line 302:19: W605 invalid escape sequence '\L'
Line 302:25: W605 invalid escape sequence '\s'
Line 302:40: W605 invalid escape sequence '\s'
Line 302:62: W605 invalid escape sequence '\l'
Line 439:23: E124 closing bracket does not match visual indentation

Line 3:1: F401 'numpy as np' imported but unused
Line 8:1: F401 'statsmodels.discrete.tests.results.results_dcm_clogit.Travelmodechoice' imported but unused

Line 3:1: F401 'numpy as np' imported but unused
Line 8:1: F401 'statsmodels.discrete.tests.results.results_dcm_clogit.Travelmodechoice' imported but unused

@josef-pkt josef-pkt mentioned this pull request Feb 14, 2022
@josef-pkt
Copy link
Member Author

notebook has output in it.

This might need a lot of squashing.

@lgtm-com
Copy link

lgtm-com bot commented Feb 14, 2022

This pull request introduces 8 alerts when merging 06890fe into 152e27d - view on LGTM.com

new alerts:

  • 3 for Unused import
  • 2 for Testing equality to None
  • 2 for Variable defined multiple times
  • 1 for `__init__` method calls overridden method

@josef-pkt
Copy link
Member Author

josef-pkt commented Feb 14, 2022

unit tests error on import

statsmodels/discrete/dcm_clogit.py:17: in <module>
    from statsmodels.compat.collections import OrderedDict
E   ModuleNotFoundError: No module named 'statsmodels.compat.collections'
tatsmodels/discrete/tests/test_mxlogit_smoke.py:2: in <module>
    from statsmodels.compat.collections import OrderedDict
E   ModuleNotFoundError: No module named 'statsmodels.compat.collections'

large number of style, pep-8 violations

@bashtage
Copy link
Member

These are long gone.

@josef-pkt
Copy link
Member Author

no code update since 2014 is a long time (this was originally written for python 2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants