Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Statistical analysis for PHP [closed]

Tags:

php

statistics

I am trying to write a reporting system for a project I'm working on that analyzes people's pre and post test scores and does some analysis on it. I have searched to the best of my ability, but cannot find a PHP Class / set of functions that seems to do the analysis I need.

Currently, I am dumping the dataset to a CSV, and one of my co-workers is running it through SPSS to perform a paired-samples t-test (that's the analysis I need run, as we need the p-value).

I know that there is this class in PHP: http://usphp.com/manual/en/ref.stats.php, however, none of that seems to be documented to the point that I can understand it.

I don't mind having to write the analysis myself, but if it already exists, I would like to avoid re-inventing the wheel.

Thanks for any help!

like image 921
Paul Santini Avatar asked Oct 20 '10 13:10

Paul Santini


People also ask

Which statistical package do you recommend for data analysis Why?

SPSS (Statistical Package for Social Sciences) SPSS is the most widely used powerful software for complex statistical data analysis. It easily compiles descriptive statistics, parametric and non- parametric analysis as well as delivers graphs and presentation ready reports to easily communicate the results.

What are statistical packages for data analysis?

Sophisticated statistical packages such as Statgraphics, SPSS, and SAS provide programs to analyze a variety of statistical models. Also, the commonly used Microsoft Excel package includes modules for some routine statistical models such as descriptive statistics and regression analysis.

Which of the following is statistical analysis tool for business research?

Some of the most common and convenient statistical tools to quantify such comparisons are the F-test, the t-tests, and regression analysis.

How do you comment statistically significant?

The level of statistical significance is often expressed as a p-value between 0 and 1. The smaller the p-value, the stronger the evidence that you should reject the null hypothesis. A p-value less than 0.05 (typically ≤ 0.05) is statistically significant.


2 Answers

It sounds like you're going to want to use the stats_stat_paired_t function. I'm not sure if you've tried this yet, but you may be able to figure out if this function does what you need it to do by looking at its source code. Look in statistics.c, line 3201.

like image 154
Fitz Avatar answered Oct 19 '22 08:10

Fitz


Paul, I did exactly this for a psychological testing system (www.coolidgetests.com) and found it really wasn't that difficult to do on my own. Like you, I searched and searched for an available solution. It was intimidating at first to admit defeat and start writing code, but in the end I found it's wasn't too bad.

In my case, the user takes a test that generates a result (1-4) All get jammed into a DB. To do the report, I select the entire group of answers for the selected test, split them out for the answers that are scored normally and those that are reversed (1=4, 2=3, etc) then change those over with a switch statement. The two arrays are combined, then calculation functions go through to generate T, Z, and other relevant statistical scores. I kick out charts very simply via a table that's shaded based on calculated percentage.

UPDATE -

Here's my Z and T-Score Functions:

function calculateZscore($scale, $median, $stdiv) {
        if ($stdiv != 0) {
            $zval = ($scale - $median) / $stdiv;
        }

        else $zval = 0;
        return $zval;
    }

    function calculateTscore($zval) {
        $tval = 50+ (10) * ($zval);
        return $tval;
    }
like image 3
bpeterson76 Avatar answered Oct 19 '22 08:10

bpeterson76