Sol
2010-11-15 14:58:14 UTC
Hello,
I'm trying to perform GLM with statsmodels
Thanks for implementing such code into python, and I hope I will help
to build higher detailed documentation/tutorial in futur ;o)
I tried this code:
import numpy
import scikits.statsmodels as sm
SUCCESS = numpy.array([81,71,74,87,22,26,31,7,61,97,78])
FAILURE = numpy.array([19,29,26,13,78,74,69,93,39,3,22])
TOTAL = numpy.array([100,100,100,100,100,100,100,100,100,100,100])
X = numpy.array([[1868.,0.709],[1633.,0.593],[1702.,0.394],
[2001.,0.941],[506.,0.528],[598.,0.859],[713.,0.294],[161.,0.724],
[1403.,0.182],[2231.,0.994],[1794.,0.057]])
Y = numpy.array([[81, 19],[71, 29],[74, 26],[87, 13],[22, 78],[26,
74],[31, 69],[7, 93],[61, 39],[97, 3],[78, 22]])
glm = sm.GLM(Y, X, family=sm.family.Binomial())
res = glm.fit(data_weights = 100)
I raised this error:
Traceback (most recent call last):
File "C:/Users/[...]/test scipy.py", line 29, in <module>
res = glm.fit() #data_weights = 100
File "C:\Python26\lib\site-packages\scikits.statsmodels-0.2.0-
py2.6.egg\scikits\statsmodels\glm.py", line 378, in fit
returned a nan. This could be a boundary problem and should be
reported."
ValueError: The first guess on the deviance function returned a nan.
This could be a boundary problem and should be reported.
Could you help me to succeed into GLM performing with statsmodels?
Another questions:
1- can I perform the same GLM but with varying "data_weights" --> one
trial at 99, another a
I'm trying to perform GLM with statsmodels
Thanks for implementing such code into python, and I hope I will help
to build higher detailed documentation/tutorial in futur ;o)
I tried this code:
import numpy
import scikits.statsmodels as sm
SUCCESS = numpy.array([81,71,74,87,22,26,31,7,61,97,78])
FAILURE = numpy.array([19,29,26,13,78,74,69,93,39,3,22])
TOTAL = numpy.array([100,100,100,100,100,100,100,100,100,100,100])
X = numpy.array([[1868.,0.709],[1633.,0.593],[1702.,0.394],
[2001.,0.941],[506.,0.528],[598.,0.859],[713.,0.294],[161.,0.724],
[1403.,0.182],[2231.,0.994],[1794.,0.057]])
Y = numpy.array([[81, 19],[71, 29],[74, 26],[87, 13],[22, 78],[26,
74],[31, 69],[7, 93],[61, 39],[97, 3],[78, 22]])
glm = sm.GLM(Y, X, family=sm.family.Binomial())
res = glm.fit(data_weights = 100)
I raised this error:
Traceback (most recent call last):
File "C:/Users/[...]/test scipy.py", line 29, in <module>
res = glm.fit() #data_weights = 100
File "C:\Python26\lib\site-packages\scikits.statsmodels-0.2.0-
py2.6.egg\scikits\statsmodels\glm.py", line 378, in fit
returned a nan. This could be a boundary problem and should be
reported."
ValueError: The first guess on the deviance function returned a nan.
This could be a boundary problem and should be reported.
Could you help me to succeed into GLM performing with statsmodels?
Another questions:
1- can I perform the same GLM but with varying "data_weights" --> one
trial at 99, another a