Repository navigation
Description
Describe the bug
I use OrderedModel for ordinal logistic regression, encountered a 'NotImplementedError' bug.
The statsmodels vesion = 0.10.0
Code Sample, a copy-pastable example if possible
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 7 15:58:52 2019
"""
import numpy as np
import statsmodels.api as sm
from statsmodels.discrete.discrete_model import OrderedModel
from statsmodels.genmod.families import links
ReturnAppointment = ['Unlikely','VeryLikely','SomewhatLikely','VeryLikely'
,'SomewhatLikely','VeryLikely','SomewhatLikely'
,'VeryLikely','SomewhatLikely','Unlikely']
Age = [62,46,59,42,74,51,50,84,75,46]
rsp = np.array(ReturnAppointment)
pvar = np.array(Age)
X = sm.add_constant(pvar)
family=sm.families.Binomial(link = links.logit())
model = OrderedModel(rsp,X,family=family)
result = model.fit()Traceback
Details
Traceback (most recent call last):File "", line 1, in
runfile('E:/work/Amos/myAlgorithm/练习测试/bug提交_OrderedModel.py', wdir='E:/work/Amos/myAlgorithm/练习测试')
File "d:\ProgramData\Anaconda3\envs\python37\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 826, in runfile
execfile(filename, namespace)
File "d:\ProgramData\Anaconda3\envs\python37\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "E:/work/Amos/myAlgorithm/练习测试/bug提交_OrderedModel.py", line 18, in
result = model.fit()
File "d:\ProgramData\Anaconda3\envs\python37\lib\site-packages\statsmodels\discrete\discrete_model.py", line 217, in fit
disp=disp, callback=callback, **kwargs)
File "d:\ProgramData\Anaconda3\envs\python37\lib\site-packages\statsmodels\base\model.py", line 470, in fit
full_output=full_output)
File "d:\ProgramData\Anaconda3\envs\python37\lib\site-packages\statsmodels\base\optimizer.py", line 219, in _fit
hess=hessian)
File "d:\ProgramData\Anaconda3\envs\python37\lib\site-packages\statsmodels\base\optimizer.py", line 300, in _fit_newton
H = np.asarray(hess(newparams))
File "d:\ProgramData\Anaconda3\envs\python37\lib\site-packages\statsmodels\base\model.py", line 452, in hess
return self.hessian(params, *args) / nobs
File "d:\ProgramData\Anaconda3\envs\python37\lib\site-packages\statsmodels\base\model.py", line 256, in hessian
raise NotImplementedError
NotImplementedError
Activity
josef-pkt commentedon Sep 30, 2020
discrete_model.OrderedModelis a place holder not a real modelthat one was never implemented
OrderedModel in miscmodels will be added in #7035
closing this