johnny 5
johnny 5

Reputation: 20995

Estimate how many values fall below a specific deviation using the empirical rule

I'm trying to estimate how many values fall within a portion of the standard deviation. Using the empirical rule we can state that:

34% of all the values will fall between the average and 1 standard deviation 13.4% of all values will fall between 1 standard deviation and 2.

As depicted here:

enter image description here

This rule can only tells me the % of values which fall within an integer standard deviation, however I'm trying to calculate how many fall within fraction of a standard deviation. Let's take this example:

public decimal GetEastimatedNumberOfValuesWithinDistribution(int sampleSize, decimal average, decimal deviation, decimal newDataPoint)
{
    var priceDifferential = newDataPoint/sampleSize;
    var newAverage = average + priceDifferential;
    var averageDistance = average - newAverage;
    var fractionalDeviation = averageDistance / deviation;
    //How do I return the average number of points between that fall within the average to the newAverage
}

Normally If I had the full dataset I could iterate over it and manually check, However in this case I only have information about the dataset and not all of the data.

How do I estimate the amount of data points that will fall within a fraction of a deviation?

Upvotes: 1

Views: 219

Answers (1)

dxiv
dxiv

Reputation: 17638

For a normal distribution, the percentage of values falling within k⋅σ of the mean is given by erf(k/sqrt(2)) where erf is the error function. For example, erf(1/sqrt(2)) = 0.682689.. and erf(3/sqrt(2)) = 0.997300...

C# does not have an erf function built into the math package (unlike python). Numerical approximations can be found on wikipedia, or what reference should I use to use erf on SO.

Upvotes: 1

Related Questions