PHP Classes

PHP Array Statistical Class: Perform statistical operations with data in arrays

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 125 All time: 9,446 This week: 560Up
Version License PHP version Categories
m1 1.0Custom (specified...5Math
Description 

Author

This package can perform statistical operations with data in arrays.

It can take a set of data values as parameter in an array and performs several operations, like This class do all you,human can do on statistical frequency, variance, co-variance, etc..

The package can also generate chart images from the results of the processed data.

Picture of zinsou A.A.E.Moïse
  Performance   Level  
Name: zinsou A.A.E.Moïse <contact>
Classes: 50 packages by
Country: Benin Benin
Innovation award
Innovation award
Nominee: 23x

Winner: 2x

Example

<?php
include_once('array_statistical.class.php');
?>
<!DOCTYPE html>
<html><head><title>PHP array_statistical class package: Test page.</title>
<STYLE type="text/css">
<!--
#contenu {padding:5%;background-color:silver}
-->
</STYLE>
</head><body><div id="contenu"><?php
echo '<p><h2>Exemple de série statistique simple à une entrée de variable continue :</h2>';
$num=array('[10,15['=>8,'[15,20['=>5,'[20,25['=>8,'[25,30['=>6,'[30,35['=>2);
$exemple= new array_statisticals();
$exemple->__getstats($num);


echo
'<pre>';
print_r($exemple);
echo
'<pre>';echo'</p>';

echo
'<p><h2>Exemple de série statistique simple à une entrée de variable discrète :</h2>';
$num=array('a'=>20,'b'=>25,'c'=>22,'d'=>23,'e'=>21,'f'=>30,'g'=>32,'h'=>18,'i'=>18);
$exemple= new array_statisticals();
$exemple->__getstats($num);
echo
'</p>';
echo
'<pre>';
print_r($exemple);
echo
'<pre>';

// ce cas sera traité comme une série statistique à caractère quantitatif où les x prendront
// les valeurs de 0 à n pour éviter cela il faudrait indexer le tableau comme plus haut
echo '<p><h2>Exemple de série statistique simple à une entrée de variable discrète:</h2>';
$num=array(12,24,36,28,5,17);
$exemple= new array_statisticals();
$exemple->__getstats($num);

echo
'<pre>';
print_r($exemple);
echo
'<pre>';echo'</p>';

echo
'<p><h2>Exemple de série statistique simple à une entrée de variable continue :</h2>';
$num=array('[10,15['=>8,'[15,20['=>5,'[20,25]'=>8,'[25,30['=>6,'[30,65['=>32);
$exemple= new array_statisticals();
$exemple->__getstats($num);

echo
'<pre>';
print_r($exemple);
echo
'<pre>';echo'</p>';


$num=array('x'=>array(6,8,10,14,16),'y'=>array(4,8,10,12,14),'x/y'=>array(1,2,0,0,0,3,2,0,4,0,0,2,0,1,1,0,0,4,1,0,0,0,1,2,1));
$exemple= new stats_double_entry();
$exemple->__getcov($num);

echo
'<h2>exemple1 de série double entrée:<br><img src="IMG_20170113_093511.jpg"/></h2>';
echo
'<pre>';
print_r ($exemple);
echo
'<pre>';

$num=array('x'=>array('[0,2[','[2,4[','[4,6[','[6,8['),'y'=>array('[0,5[','[5,10[','[10,15[','[15,20['),'x/y'=>array(0,1,3,4,5,1,0,0,4,2,0,0,0,2,1,5));
$exemple= new stats_double_entry();
$exemple->__getcov($num);
$exemple2=(array)$exemple;

// echo '<pre>';
// print_r ($exemple);
// echo '<pre>';
echo '<p><h2>Exemple 2 de série double entrée:<br><img src="IMG_20170113_103548.jpg"/></h2>';
echo
'<b>covariance:'.round($exemple2['stats']['covariance'],4).'<br>';
echo
'coefficient de correlation linéaire:'.round($exemple2['stats']['coefficient de correlation linéaire'],4).'<br>';
echo
'Equation de la droite de regression de Y en X:'.$exemple2['stats']['Equation de la droite de regression de Y en X'].'<br>';
echo
'Equation de la droite de regression de X en Y:'.$exemple2['stats']['Equation de la droite de regression de X en Y'].'<br>';
echo
'variance de la serie marginale selon x:'.round($exemple2['stats']['serie marginale selon x']['variance'],4).'<br>';
echo
'variance de la serie marginale selon y:'.round($exemple2['stats']['serie marginale selon y']['variance'],4).'<br></b></p>';
?></div></body></html>


Details

hi! Array_statistical class is a simple class to manipulate statistical informations. His usage is very easy and the simple thing you must do is to proceed just like we do in the test.php file.Look out to fill your arrays just as we do,line by line and the class will do all the remain.Feel free to use it as you want and modify it like you thought. This class do all you,human can do on statistical informations from frequence calculation to covariance and so much more... feedback to leizmo@gmail.com

  Files folder image Files (6)  
File Role Description
Plain text file array_statistical.class.php Class array_statistical.class
Accessible without login Image file IMG_20170113_093511 Data example picture
Accessible without login Image file IMG_20170113_103548 Data example picture
Accessible without login Plain text file license Lic. license
Accessible without login Plain text file readme Data read me
Accessible without login Plain text file test.php Example test

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:125
This week:0
All time:9,446
This week:560Up