Code in this package first appeared on the O'Reilly Network on July 23, 2004.
by Paul Meagher <paul@datavore.com>
Last modified March 31 2006 @ 1:23 pm UTC
Demos:
Source code listing:
<?php
/**
* @package SFA
*
* Script performs single factor ANOVA analysis on test anxiety
* data stored in a database.
*
* @author Paul Meagher, Datavore Productions
* @license PHP v3.0
* @version 0.7
*
* The config.php file defines paths to the root of the PHPMATH
* and JPGRAPH libraries and sets up a global database connection.
*/
require_once "config.php";
require_once PHPMATH ."/SFA/SingleFactorANOVA.php";
$sfa = new SingleFactorANOVA;
// Step 1: Specify and analyze data
$sfa->setTable("TestScores");
$sfa->setTreatment("anxiety");
$sfa->setResponse("score");
$sfa->analyze();
// Step 2: Show raw data
$sfa->showRawData();
// Step 3: Show box plot
$params["figureTitle"] = "Anxiety Study";
$params["xTitle"] = "Anxiety Level";
$params["yTitle"] = "Test Score";
$params["yMin"] = 0;
$params["yMax"] = 100;
$params["yTicks"] = 10;
$sfa->showBoxPlot($params);
// Step 4: Show descriptive statistics
$sfa->showDescriptiveStatistics();
// Step 5: Show single factor ANOVA source table
$sfa->showSourceTable();
// Step 6: Show mean differences.
$sfa->showMeanDifferences();
?>