Bug#860449: python-statsmodels: KaplanMeier.fit() crashes

Kingsley G. Morse Jr. kingsley at loaner.com
Mon Apr 17 04:11:19 UTC 2017


Package: python-statsmodels
Version: 0.8.0-1
Severity: normal

In a secret underground lab, a solitary caped
figure kneels in front of a computer screen.

Who is this mysterious genius??

And why has he never been photographed together
with tall, dark, handsome Kingsley?

A lightning bolt blasts across the keyboard!

Look!

Up in the sky!

Is it a bird?

No!

Is it a plane?

NO!

It's...

IT'S...

YES!!!

It'S ... SCIENCE MAN!!!!!!!

Champion of critical thinking!

Defender of data!

Sworn foe of boring bug reports everywhere!

But wait!

What's this?

A diabolical bug has infested the python-statsmodels package!

Oh no!

It threatens to establish a totalitarian system of
rule over Kaplan Meier calculations!

What CAN be done?

SCIENCE MAN uses his super powers to reveal to all
lovers of truth, justice and statistics just how to
elicit the bug.

He tried the example starting on line 64 of

    /usr/lib/python2.7/dist-packages/statsmodels/sandbox/survival2.py

What woe befell our hero?

Behold!

    >>> import statsmodels.api as sm
    >>> import matplotlib.pyplot as plt
    >>> import numpy as np
    >>> from statsmodels.sandbox.survival2 import KaplanMeier
    >>> dta = sm.datasets.strikes.load()
    >>> dta = dta.values()[-1]
    >>> dta[range(5),:]
    array([[  7.00000000e+00,   1.13800000e-02],
           [  9.00000000e+00,   1.13800000e-02],
           [  1.30000000e+01,   1.13800000e-02],
           [  1.40000000e+01,   1.13800000e-02],
           [  2.60000000e+01,   1.13800000e-02]])
    >>> km = KaplanMeier(dta,0)
    >>> km.fit()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python2.7/dist-packages/statsmodels/sandbox/survival2.py", line 203, in fit
        self.fitting_proc(self.data)
      File "/usr/lib/python2.7/dist-packages/statsmodels/sandbox/survival2.py", line 249, in fitting_proc
        events = events[:,list(t)]
    IndexError: too many indices for array

Zounds!!!!

An IndexError has rendered SCIENCE MAN'S super
powers useless!

SCIENCE MAN has been vanquished by his
arch-nemesis, bad code!

With his last breath, SCIENCE MAN gasps that the
same error happened with version
0.8.0~rc1+git59-gef47cd9-5.

Certainly the bug will now be fixed by a super genius maintainer!

Or will it...?


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 4.4.0-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages python-statsmodels depends on:
ii  python                  2.7.13-1
ii  python-numpy            1:1.12.0-2
ii  python-patsy            0.4.0-1
ii  python-scipy            0.18.1-2
ii  python-statsmodels-lib  0.8.0-1
pn  python:any              <none>

Versions of packages python-statsmodels recommends:
pn  python-cvxopt      <none>
ii  python-joblib      0.9.2-1
ii  python-matplotlib  2.0.0-3
ii  python-nose        1.3.6-1
ii  python-pandas      0.17.0+git8-gcac4ad2-2

Versions of packages python-statsmodels suggests:
ii  python-statsmodels-doc  0.8.0~rc1+git59-gef47cd9-5

-- no debconf information



More information about the debian-science-maintainers mailing list