python中非线性回归的Cook距离计算

2024-05-16 13:33:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用Python计算非线性回归的Cook距离。我在网上只能找到它在线性回归上的应用(https://www.scikit-yb.org/en/latest/api/regressor/influence.htmlhttps://www.statsmodels.org/stable/generated/statsmodels.stats.outliers_influence.OLSInfluence.cooks_distance)。然而,我使用的是一种形式的幂回归:a*x**b+c。 下面是我的回归的一个示例: power regression

我真的很想使用库克距离来去除异常值,在我尝试自己实现它之前,我只是想确保我没有遗漏任何东西

根据我对它的理解(https://en.wikipedia.org/wiki/Cook%27s_distance),我需要做2*n回归(其中n是数据点的数量)来获得每个点的权重

我知道Matlab中有一个函数,您可以在其中输入任何函数(https://www.mathworks.com/help/stats/cooks-distance.html),但我想知道是否有与Python等效的函数

谢谢


Tags: 函数httpsorg距离htmlwwwstats线性