Jump to content

statistics_stardard_deviation


smerny

Recommended Posts

http://us3.php.net/manual/en/function.stats-standard-deviation.php

 

Warning

 

This function is currently not documented; only its argument list is available.

 

this doesn't work for me, "undefined function", is there something I can do? or another function to use? or do I just need to create my own to use?

Link to comment
https://forums.phpfreaks.com/topic/182518-statistics_stardard_deviation/
Share on other sites

Well after 10 minutes of trying to figure out how to use 'bar x' in the [tex] tag..

 

You can install the math extension, or just create your own standard_deviation function, it's not that hard.. Ex:

 

<?php
function standard_deviation($arr)
{
$bar_x = array_sum($arr) / count($arr);
foreach($arr as $x)
	$dev[] = pow($x - $bar_x, 2);
return sqrt(array_sum($dev) / count($arr));
}

echo standard_deviation(Array(78, 84, 86, 92, 95)); // 6

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.