Skip to content Skip to sidebar Skip to footer

Neither Percentile_cont Nor Percentile_disc Are Calculating The Desired 75th Percentile In Postgresql 9.6.3

Working with the percentile functions, but I am not getting the desired output. I would say 'incorrect', but the functions are probably working as they are intended, and I am just

Solution 1:

Posted this question to Reddit and was able to get some help.

Apparently, the percentile_cont function, in addition to percentile and percentile.inc functions in Excel, calculate using the C=1 variant of linear interpolation as explained in this Wikipedia:

https://en.wikipedia.org/wiki/Percentile#Second_variant.2C_.7F.27.22.60UNIQ--postMath-00000043-QINU.60.22.27.7F

Apparently, what I have been using is called Empirical Distribution with Averaging.

So the native functions of PostgreSQL won't work so well and will need to make a custom function which I will post when I am done. (I suspect it will use the old ntile method from before 9.4, but still looking into it).

But anyway, that is why it is off.

Post a Comment for "Neither Percentile_cont Nor Percentile_disc Are Calculating The Desired 75th Percentile In Postgresql 9.6.3"