开发者

Statistical analysis for PHP [closed]

开发者 https://www.devze.com 2023-01-21 03:09 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

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 avoi开发者_如何学编程d re-inventing the wheel.

Thanks for any help!


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.


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;
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消