dreamwest Posted June 16, 2012 Share Posted June 16, 2012 I have a few prices and need to find the median of them, the problem is there is sometimes one really high price that distorts the median. Is there a way to normalize the figures? Example numbers 76 87 95 78 104 1098 Normally i would do it this way but it gives a distorted view of the median number $lowest = 76; $highest = 1098; $mid = (($lowest - highest) / 2) + $lowest; // echos 511 Quote Link to comment https://forums.phpfreaks.com/topic/264292-median-price/ Share on other sites More sharing options...
cpd Posted June 16, 2012 Share Posted June 16, 2012 Your trying to eliminate anomalies? Moreover, your not even working the median number out doing this. Your working out the average of two numbers otherwise referred to as the mean number; you then add the lowest figure to it completely throwing it off and well... I don't even think there is a word to describe what your doing here. The median is the middle value of a range of numbers. Should there be an even number of numbers, the two middle values are added together and divided by two. Mathematics lesson over (Y). Quote Link to comment https://forums.phpfreaks.com/topic/264292-median-price/#findComment-1354404 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.