regent Posted March 28, 2007 Share Posted March 28, 2007 Anybody know how to calculate quartiles? Thanks. Link to comment https://forums.phpfreaks.com/topic/44573-quartiles-function/ Share on other sites More sharing options...
AndyB Posted March 28, 2007 Share Posted March 28, 2007 Yes. http://en.wikipedia.org/wiki/Quartile Assuming this is a question and not a poll, why don't you define your real problem. Link to comment https://forums.phpfreaks.com/topic/44573-quartiles-function/#findComment-216483 Share on other sites More sharing options...
ToonMariner Posted March 28, 2007 Share Posted March 28, 2007 I suspect you is going to have to roll your own... there are snippets out there on things like standard deviation and other statistical techniques so get looking... and rolling! Link to comment https://forums.phpfreaks.com/topic/44573-quartiles-function/#findComment-216489 Share on other sites More sharing options...
hitman6003 Posted March 28, 2007 Share Posted March 28, 2007 I took the example provided here: http://www.vias.org/tmdatanaleng/cc_quartile.html You could easily turn this into a function.... $values = array(-20, -4, -1, -1, 0, 1, 2, 3, 4, 4, 7, 7, 8, 11, 11, 12, 12, 15, 18, 22); $count = count($values); $first = round( .25 * ( $count + 1 ) ) - 1; $second = ($count % 2 == 0) ? ($values[($count / 2) - 1] + $values[$count / 2]) / 2 : $second = $values[($count + 1) / 2]; $third = round( .75 * ( $count + 1 ) ) - 1; echo "<pre>" . print_r($values, true) . " first = $first<br /> values[first] = $values[$first]<br /> <br /> second = $second<br /> <br /> third = $third<br /> values[third] = $values[$third]"; Link to comment https://forums.phpfreaks.com/topic/44573-quartiles-function/#findComment-216491 Share on other sites More sharing options...
regent Posted March 28, 2007 Author Share Posted March 28, 2007 Thank you, hitman6003. That's exactly what I was looking for. Link to comment https://forums.phpfreaks.com/topic/44573-quartiles-function/#findComment-216804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.