如何使用最大似然估计将负二项式模型拟合到数据

问题描述

我正在尝试将负二项分布拟合到只有一个字段且该字段是句子中的单词数的数据集。如何使用 statsmodels.discrete.discrete_mode 拟合分布

解决方法

我认为 statsmodels 类只是作为回归模型的后端资产,而不是用于拟合分布。请参阅此处的参考:Regression with Discrete Dependent Variable

但是在 other question here 的答案中,有一个链接,其中包含一个可能的解决方法来利用 statsmodels 回归模型来拟合您的分布:Newbie question about discrete distributions and MLE

我也为您查看了 scipy.stats.nbinom,因为 scipy 具有适用于各种分布的 MLE 拟合方法。但是离散分布没有拟合方法。 这里有很多答案解释了其中的困难,以及一些替代方法:

作为除上述答案中提到的方法之外的另一种可能性,我建议您使用 PyMC3 package 查看贝叶斯数值方法,因为它也包括 Negative Binomial 分布。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...