Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top