numdifftools dependency

Bug #653902 reported by Vincent Davis
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
statsmodels
New
Undecided
Unassigned

Bug Description

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 ?

Tags: numdifftools

Related branches

Revision history for this message
Skipper Seabold (jsseabold) wrote :

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.

Revision history for this message
joep (josef-pktd) wrote :

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.

Revision history for this message
joep (josef-pktd) wrote :

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 <module>
    execfile(m)
  File "C:\Josef\eclipsegworkspace\statsmodels-josef-experimental-gsoc\scikits\s
tatsmodels\sandbox\regression\numdiff.py", line 372, in <module>
    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'

Revision history for this message
Skipper Seabold (jsseabold) wrote :

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

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.