如何使用 scipy.odr 估计拟合优度? [英] How to estimate goodness-of-fit using scipy.odr?
问题描述
我正在使用 scipy.odr 拟合数据与权重,但我不知道如何获得拟合优度或 R 平方的度量.有人对如何使用函数存储的输出获得此度量有建议吗?
I am fitting data with weights using scipy.odr but I don't know how to obtain a measure of goodness-of-fit or an R squared. Does anyone have suggestions for how to obtain this measure using the output stored by the function?
推荐答案
Output
是所谓的拟合卡方值,这是一种流行的选择拟合统计.不过,对于非线性拟合来说有些问题.您可以直接查看残差(out.delta
用于 X
残差,out.eps
用于 Y
残差).如链接论文中所建议的那样,实施交叉验证或引导方法来确定拟合优度,留给读者作为练习.
The res_var
attribute of the Output
is the so-called reduced Chi-square value for the fit, a popular choice of goodness-of-fit statistic. It is somewhat problematic for non-linear fitting, though. You can look at the residuals directly (out.delta
for the X
residuals and out.eps
for the Y
residuals). Implementing a cross-validation or bootstrap method for determining goodness-of-fit, as suggested in the linked paper, is left as an exercise for the reader.
这篇关于如何使用 scipy.odr 估计拟合优度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!