PHP估算函数

发布于 2024-09-10 17:11:04 字数 292 浏览 4 评论 0原文

我正在尝试根据数字数组(如 $numbers)计算数字系列中的值 $x。

例如:

$numbers = array(1=>1000,2=>600,3=>500,4=>450,5=>425,6=>405,7=>400,8=>396);
function estimateNumber($x) {
  // function to estimate number $x in $numbers data set
}

统计上最准确的方法是什么?

I am trying to calculate value $x in a number series based on an array of numbers (as $numbers).

Ex:

$numbers = array(1=>1000,2=>600,3=>500,4=>450,5=>425,6=>405,7=>400,8=>396);
function estimateNumber($x) {
  // function to estimate number $x in $numbers data set
}

What would be the most statistically accurate method?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

绿光 2024-09-17 17:11:05

不存在单一的“统计上最准确的方法”。这取决于您的估计值以及之前观察到的值。根据您现有的一组值,它似乎呈指数下降,并且如您所见,到第 7 个和第 8 个值时,它已经达到分别仅下降 5 和 4 的点。您可以预期该值会进一步减少 3、2 和 1,之后它将几乎保持不变,仅在小数位上发生一点变化。

这将是一个公平的近似值:

...
7  => 400
8  => 396
9  => 393
10 => 391
11 => 390
12 and above => 389.xxx

There is no single "most statistically accurate method". It depends on what you are estimating as well as previously observed values. Going by your existing set of values, it seems to be exponentially decreasing, and as you can see, by the 7th and 8th values, it's already reached a point where it decreases only by 5 and 4 respectively. You can expect this to further reduce by 3, 2 and 1, after which it would become almost constant, only changing a little in the decimal places.

This would be a fair approximation:

...
7  => 400
8  => 396
9  => 393
10 => 391
11 => 390
12 and above => 389.xxx
秋风の叶未落 2024-09-17 17:11:04

您尝试做的是数学的一个大分支,称为插值。声称一种方式比另一种方式“统计上更准确”可能会引发宗教战争。这完全取决于您要插入的数据类型。

线性插值将是最简单的。

What you're attempting to do is a large branch of mathematics called interpolation. Claiming one way is more "statistically accurate" than the other will probably spark religious wars. It all depends on what kind of data you're trying to interpolate.

Linear interpolation will be the most straightforward.

旧伤还要旧人安 2024-09-17 17:11:04

您需要决定是要拟合直线还是 n 阶多项式。也许可以尝试 Excel 中的一些示例来了解您需要什么。

You need to decide if you want to fit a straight line or an n-th order polynomial. Maybe try some examples in Excel to give you an idea of which you need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文