Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mathematic statistical library for PHP [closed]

Tags:

php

statistics

I wonder, if there is a library for statistical tests like

  • t-test
  • Anova test
  • Kolmogorov Smirnov etc..... for PHP?

I found a pecl extension: http://php.net/manual/de/book.stats.php , which gives some basic parameters, but no tests found yet

like image 520
Sebastian Viereck Avatar asked Dec 24 '12 07:12

Sebastian Viereck


1 Answers

If you want a full PHP library you can have a look here, but I don't know if it is something really good.

This statistical test is quite gready and I don't know if php is a good choice to compute it. As proposed in the comments, you should write your script in R language and then call it. There are two ways to call another language depending on your server architecture. Assuming you will have only one server, you can use 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);

You can also use cURL to contact a Rscript on another server with RCurl.

like image 103
artragis Avatar answered Oct 21 '22 08:10

artragis