tags:

views:

54

answers:

2

I cannot figure out how to set an estimated maximum price for a collection of records.

What I want to avoid is to simply use SQL MAX, because maybe there are records with exorbitant prices.

For example, in the "computers-hardware" category of OLX (http://www.olx.com/computers-hardware-cat-240) the filter for maximum price is estimately set to $1400, but sorting by price, the first items are above $10000

Maybe they calculated the average and then estimated some maximum price... what do you think?

A: 

so what is that you are asking for? computers do what they are exactly asked to do. Look into statistical functions - median etc. (http://en.wikipedia.org/wiki/Median)

Axarydax
A bit condescending, don't you think?
Marcelo Cantos
+2  A: 

If you assumed normal (gaussian) distribution on the prices you could estimate the maximum using this formula

avg(price) + 3*stddev(price)

If the distribiution is indeed gaussian about 95% of the samples should be contained within [avg - 3*stddev ; avg + 3*stddev]

pablochan
Is there some way to find a maximum that contains the 90% of the samples, instead of the 95%?I'm asking this because if there are 2 or 3 exorbitant prices, the estimated maximum will be too high...I have tried replacing 3* by 2*, and I think it's nearer for what I'm searching for...
David
the 3 is just the usual value, you can modify it to fit your needs, like I said it depends on the distribution of the samples. Obviously you can just remove the outliers manually but I'm guessing that's not the point.
pablochan