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

numdifftools dependency #45

Closed
wesm opened this issue Aug 25, 2011 · 4 comments
Closed

numdifftools dependency #45

wesm opened this issue Aug 25, 2011 · 4 comments
Labels

Comments

@wesm
Copy link
Member

wesm commented Aug 25, 2011

Original Launchpad bug 653902: https://bugs.launchpad.net/statsmodels/+bug/653902
Reported by: vincent-vincentdavis (Vincent Davis).

statsmodels/init.py imports tsa
Which then returns an exception from statsmodels/tsa/var.py "raise Warning("You need to install numdifftools to try out the AR model")"
Should numdifftools be a dependency for all of statsmodels ?

@wesm
Copy link
Member Author

wesm commented Aug 25, 2011

[ LP comment 1 by: Skipper Seabold, on 2010-10-04 15:42:44.878854+00:00 ]

Should we include numdifftools or go ahead and use the versions that we have in the sandbox?

Strictly speaking neither is necessary as the solvers don't yet require the score and hessian methods, but they will if we want to inherit from LikelihoodModel.

@wesm
Copy link
Member Author

wesm commented Aug 25, 2011

[ LP comment 2 by: joep, on 2010-10-04 16:14:56.316846+00:00 ]

The solvers don't need it (not all of them), but the likelihood methods (generic, non-linear or non-normal) need the Jacobian or/and Hessian to calculate the cov_params and bse. Plus there are other places where we need numerical derivatives, e.g. derivatives of moment conditions in gmm and in delta-method to get bse and cov_params for non-linear transformation of estimated parameters. (this function is currently together with generic mle poisson)

(current status copied from the mailinglist)
In generic maximum likelihood I only use our version from numdiff.
There are some problems if the loglikelihood function is not nice, but
I haven't checked yet whether numdifftools would do better. (one
problem I had with zero-inflated poisson was bad scaling when the
parameter estimate should be infinite, i.e. a boundary solution.)

There will always be some problems with numerical differentiation, but
I think the complex method will be the best solution when it works,
but it's not included in our numdiff yet.

I wouldn't change around too much with numerical differentiation,
until we have cleaned up our numdiff. Then, before the release, we can
decide whether we want to include (a robustified) numdifftools, or we
include it anyway just to have a way to check numerical derivatives.

@wesm
Copy link
Member Author

wesm commented Aug 25, 2011

[ LP comment 3 by: joep, on 2011-01-17 13:45:28.184022+00:00 ]

numdifftool (no version information in the installed package) raises exception with numpy 1.5.1 when running the main part in our numdiff"

scikits\statsmodels\sandbox\regression\numdiff.py

Traceback (most recent call last):
File "C:\Josef\eclipsegworkspace\statsmodels-josef-experimental-gsoc\tools\exe
cdirs.py", line 30, in
execfile(m)
File "C:\Josef\eclipsegworkspace\statsmodels-josef-experimental-gsoc\scikits\s
tatsmodels\sandbox\regression\numdiff.py", line 372, in
hessnd = hnd(xk)
File "C:\Programs\Python25\lib\site-packages\numdifftools\core.py", line 1146,
in call
return self._hessian(x00)
File "C:\Programs\Python25\lib\site-packages\numdifftools\core.py", line 789,
in _hessian
hess = self._hessdiag(x00);
File "C:\Programs\Python25\lib\site-packages\numdifftools\core.py", line 771,
in _hessdiag
return self._partial_der(x00)
File "C:\Programs\Python25\lib\site-packages\numdifftools\core.py", line 740,
in _partial_der
PD[ind] = self._derivative(x0[ind])
File "C:\Programs\Python25\lib\site-packages\numdifftools\core.py", line 694,
in _derivative
[der_romb,errors] = self._rombextrap(der_init)
File "C:\Programs\Python25\lib\site-packages\numdifftools\core.py", line 512,
in _rombextrap
[qromb,rromb] = linalg.qr(rmat,econ=True);
TypeError: qr() got an unexpected keyword argument 'econ'

@wesm
Copy link
Member Author

wesm commented Aug 25, 2011

[ LP comment 4 by: Skipper Seabold, on 2011-02-17 19:01:40.569441+00:00 ]

There is still one unprotected import of numdifftools in tsa/mlemodel.py

jseabold added a commit that referenced this issue Oct 5, 2012
ENH: Protect numdifftools import. Closes #45
PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014
PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this issue Sep 2, 2014
ENH: Protect numdifftools import. Closes statsmodels#45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants