Home arrow PHP arrow Page 3 - Performing Inferential Statistical Analysis with PHP

Programming Strategy in PHP - PHP

Statistics aren't just for Excel spreadsheets anymore. If you've been wondering how to use PHP to help you do a basic statistical analysis, keep reading. In this article you'll learn how to use PHP to help you compare data sets.

TABLE OF CONTENTS:
  1. Performing Inferential Statistical Analysis with PHP
  2. Overview of Statistical Comparison
  3. Programming Strategy in PHP
  4. The PHP Code
By: Codex-M
Rating: starstarstarstarstar / 2
October 07, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

It can be difficult to implement the above concepts in the programming. This is why you'll find very few PHP developers online who are willing to develop this kind of application.

Anyway, with the solid background provided above, we can start with a web form that accepts two data sets. It should be two text areas, to make it easy for users to enter data (using the copy-and-paste method instead of entering data one small piece at a time, which can be very stressful to use).

The script should then accept the numerical data and start computing the descriptive statistics (average, standard deviation, degrees of freedom). With these variables computed, we can compute the T value.

So how will the T-critical value be computed? The best method is to obtain t-critical value from MS Excel, save it as .csv, and then export it to the MySQL database. To follow the industry standard, we can fix those tables to use the 95% confidence level.

In Excel, the T-critical value can be computed using the Excel function called TINV (%error, degrees of freedom), so for a 95% level, % error is 5% (0.05). In an Excel spreadsheet, a table can be generated using this formula, like the one shown below:

Complete the tables as shown above (you can have more than 100 “degrees of freedom” to make sure your applications can accept high amount of samples).

If you have trouble converting your Excel worksheet to a MySQL database, you'll find a tutorial on ASP Free at the link to help you. 

Once the t-critical value is in place at the MySQL database, we can query it based on degrees of freedom and use PHP to compare it with the T value computed (above).



 
 
>>> More PHP Articles          >>> More By Codex-M
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap

Dev Shed Tutorial Topics: