gpt4 book ai didi

mathnet-numerics - GoodnessOfFit.StandardError 错误答案

转载 作者:行者123 更新时间:2023-12-04 07:25:49 26 4
gpt4 key购买 nike

为什么我从 GoodnessOfFit.StandardError 得到错误的答案 (err2)?在下面的代码中,我自己进行计算并得到正确的答案 (err3)。我从 GoodnessOfFit.RSquared 得到正确答案。注意:esttime 和 phrf 是 double[]。长度为 63。

    Tuple<double, double> p = Fit.Line(esttime, phrf);
double ss = 0.0;
for (int j = 0; j < esttime.Length; j++)
{
est[j] = p.Item1 + p.Item2 * esttime[j];
ss += Math.Pow(est[j] - phrf[j], 2);
}
double err2 = GoodnessOfFit.StandardError(est, phrf, phrf.Length - 2);
Console.WriteLine(err2.ToString()); //writes 70.91 which is wrong
double err3 = Math.Sqrt(ss / est.Length - 2);
Console.WriteLine(err3.ToString()); // writes 12.56 which is correct

最佳答案

答案:第三个参数,自由度,实际上是回归中失去的自由度数。因此,在示例中,它应该是 2 而不是 phrf.Length - 2。即便如此,它也不完全符合我的计算和 Excel 的计算。

关于mathnet-numerics - GoodnessOfFit.StandardError 错误答案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48624950/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com