Skip to content
DeepForgeby svx
All problems
HardStatisticsst-327

Sheppard Correction for Binned Variance

Problem

When data are grouped into bins of width h, the within-bin grouping inflates the variance by about h^2 / 12; the corrected variance subtracts that term.

Given the binned variance and the bin width, return the Sheppard-corrected variance (floored at zero).

Hint

Subtract h^2 / 12 and do not allow negative values.

Test cases

case 1
in: [2,1]
expected: 1.9166666666666667
case 2
in: [0.1,1]
expected: 0.016666666666666677
case 3
in: [0.084,0.5]
expected: 0.06316666666666668
Starter codePython
def sheppard_correction_for_binned_variance(binned_variance, bin_width):
    # Your code here
    pass

3 test cases · run your code against them in the editor