python - 如何从 Python 中的有序 logit 模型中检索残差?
问题描述
我已使用此代码在 Python 中运行有序的 logit:
import numpy as np
import pandas as pd
import scipy.stats as stats
pip install git+https://github.com/statsmodels/statsmodels
from statsmodels.miscmodels.ordinal_model import OrderedModel
mod_log = OrderedModel(df_final5['ADJUST_5']
,df_final5[['STRESS_2','ISO_4','ADJUST_1','WRKIND_1','HOMENV_3','WLBAL_1','WLBAL_2','ITSKIL_2','ORGCHAR_4','SUPP_1','INDGIVEN_1','DEMO_1','DEMO_3','GENWFH_2','GENWFH_3','FAM_2','ORGCHAR_2','ORGCHAR_3','GENDER','SWEXP','COMTYPE']]
,distr='logit')
res_log = mod_log.fit(method='bfgs', disp=False)
print_logit = res_log.summary()
print(print_logit)
我现在正在努力从模型中检索残差。我尝试过使用与 OLS 相同的代码:
res=res_log.resid
但不幸的是,该模型没有 resid 属性。
你有解决办法吗?
解决方案
推荐阅读
- java - 如何修复:javax.xml.bind.UnmarshalException:意外元素(uri:“”,本地:“目录”)。预期元素是(无)
- django - 如何在 Django Rest Framework 中获取属于特定用户的数据?
- python - 自制软件安装了 pip 中缺少的 python 包
- sql - 如何使用 typeORM 制作复杂的嵌套 where 条件?
- php - 在不重新加载的情况下向 div 添加/删除内容
- java - Selenium WebDriver - 无法处理页面加载时出现的警报
- amazon-web-services - 如何将数据从 s3 存储桶迁移到冰川?
- javascript - 将带有子变量的变量从 JQuery 传递到 Flask 应用程序
- python - 在 Python 中平均 pi 的位数
- r - 字符向量是否有 tidyr::extract 等效项?