PHP Classes
elePHPant
Icontem

File: testDrive.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Alejandro Mitrou  >  PHP Spearman Rank Correlation  >  testDrive.php  >  Download  
File: testDrive.php
Role: Example script
Content type: text/plain
Description: Class usage samples.
Class: PHP Spearman Rank Correlation
Compute the Spearman Correlation and draw results
Author: By
Last change:
Date: 1 year ago
Size: 875 bytes
 

Contents

Class file image Download
<?php
 
include('SpearmanCorrelation.php');
 
$data0 = array(1, 2, 6, 7, 7, 7, 7, 1, 6, 6, 6, 6, 6, 6, 6);
 
$data1 = array(0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 16.5, 18.8, 19.9);
 
$data2 = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
 
$data3 = array(3, 3, 3, 3, 3, 3, 8, 9, 10, 11, 12, 13, 14, 15, 16);
 
$data4 = array(5, 4, 7, 3, 6, 8, 11, 12, 10, 9, 13, 100, 14, 15, 16);
 
$matrix = array();
 
array_push($matrix, $data0, $data1, $data2, $data3);

 
$sp = new SpearmanCorrelation();
 
#Correlation coefficient between two arrays
 
$result = $sp->test($data4, $data3);
 
$sp->drawResults();
 
 
#Finding correlation within a matrix
 
$result = $sp->testMatrix($matrix);
 
 
#Displays resulting coefficient matrix
 
$sp->drawResults();
 
#As previous one, focusing on correlated variables
 
$sp->drawResults(0.8, TRUE);
?>