scipy.stats.linregress 中标准误差的定义
Definition of standard error in scipy.stats.linregress
我正在使用 scipy.stats.linregress 函数对一些二维数据进行简单的线性回归,例如:
from scipy import stats
x = [5.05, 6.75, 3.21, 2.66]
y = [1.65, 26.5, -5.93, 7.96]
gradient, intercept, r_value, p_value, std_err = stats.linregress(x,y)
该函数的文档指出 std_err
是:
Standard error of the estimate
我不确定这是什么意思。这个 old answer 说它代表了“梯度线的标准误差”但是这个“并不总是这个库的行为".
我能得到这个参数究竟代表什么的精确定义吗?
这是统计中的标准度量。有关如何计算它的说明,请参阅 wikipedia。不幸的是,Whosebug 似乎没有 LaTeX 支持,因此在这里写出和解释方程式没有意义。
本质上,std_err
应该为梯度中表示的每个系数给出一个值。简而言之,std_err
告诉您梯度对数据的拟合程度(较高的值意味着不太精确)。
截至 2016 年 12 月,我认为它仍然显示 OLS 回归线斜率的标准误差。我使用 orthogonal distance regression as part of the scipy package, and the output's sd_beta[1]
(representative of the standard error of the slope of the regression line) was very similar to the std_err
as calculated by scipy.stats.linregress.
计算了一些数据集的回归
我正在使用 scipy.stats.linregress 函数对一些二维数据进行简单的线性回归,例如:
from scipy import stats
x = [5.05, 6.75, 3.21, 2.66]
y = [1.65, 26.5, -5.93, 7.96]
gradient, intercept, r_value, p_value, std_err = stats.linregress(x,y)
该函数的文档指出 std_err
是:
Standard error of the estimate
我不确定这是什么意思。这个 old answer 说它代表了“梯度线的标准误差”但是这个“并不总是这个库的行为".
我能得到这个参数究竟代表什么的精确定义吗?
这是统计中的标准度量。有关如何计算它的说明,请参阅 wikipedia。不幸的是,Whosebug 似乎没有 LaTeX 支持,因此在这里写出和解释方程式没有意义。
本质上,std_err
应该为梯度中表示的每个系数给出一个值。简而言之,std_err
告诉您梯度对数据的拟合程度(较高的值意味着不太精确)。
截至 2016 年 12 月,我认为它仍然显示 OLS 回归线斜率的标准误差。我使用 orthogonal distance regression as part of the scipy package, and the output's sd_beta[1]
(representative of the standard error of the slope of the regression line) was very similar to the std_err
as calculated by scipy.stats.linregress.