PHP的数学统计库

7

我想知道是否有一个与PHP相关的统计检验库,例如:

  • t检验
  • Anova检验
  • Kolmogorov Smirnov 等等......

我找到了一个PECL扩展:http://php.net/manual/de/book.stats.php,它提供了一些基本参数,但还没有发现任何测试。


1
你有考虑过使用R语言(http://en.wikipedia.org/wiki/R_(programming_language))并通过rCurl(http://cran.r-project.org/web/packages/RCurl/index.html)在PHP中访问它吗? - calumbrodie
1个回答

3
如果您需要完整的PHP库,可以查看这里,但我不确定它是否真的很好。
这个统计检验非常消耗资源,我不知道php是否是计算它的一个好选择。如评论所建议的,您应该使用R语言编写脚本,然后调用它。
根据您的服务器架构,有两种调用另一种语言的方法。假设您只有一个服务器,您可以使用proc_open
$descriptorspec = array(
   0 => array("pipe", "r"),  //a pipe where you will read
   1 => array("pipe", "w"),  //std out : a pipe where you will write
   2 => array("file", "/tmp/error-output.txt", "a") // stderr : a log file, not mandatory here
);
 $pipes = array();
$process = proc_open('R yourfile.r',$decriptorspec,$pipes);

fwrite($pipes[0],$yourStatsToBeCompute);
$result = stream_get_contents($pipes[1]);
fclose($pipes[0]);
fclose($pipes[1]);
proc_close($process);

您可以使用cURL和RCurl联系另一台服务器上的R脚本。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接