Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

calculate Chi-Square test

by dicty (Sexton)
on Feb 05, 2013 at 20:27 UTC ( #1017275=perlquestion: print w/replies, xml ) Need Help??
dicty has asked for the wisdom of the Perl Monks concerning the following question:

How to calculate Chi-Square test P-value with Perl? Any example? My input is the value X to evaluate the distribution and the number of the degrees of freedom.



Replies are listed 'Best First'.
Re: calculate Chi-Square test
by blue_cowdawg (Monsignor) on Feb 05, 2013 at 20:37 UTC

      Statistics::ChiSquared is not a suitable package except for preliminary investigation, as it returns a text string which you have to parse the numbers out of, but more importantly as it doesn't return the correct numbers, but rounds everything off to the nearest 5% (and appears to have some special love of 30% and 70%).

      If every mathematical package returned a text string explaining the result rather than the result, because they don't trust you to interpret the result correctly, using Perl for math would be hell.

      Note the documentation says "use Statistics::Chisquare", but correct usage is "use Statistics::ChiSquare".

      Good bosses don't ask you to work on a solved problem. :)

        Emphasis on the word "good." :-)

        Peter L. Berghold -- Unix Professional
        Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: calculate Chi-Square test
by moklevat (Priest) on Feb 06, 2013 at 15:02 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1017275]
Approved by blue_cowdawg
[stonecolddevin]: o/ planetscape
[Sinistral]: I think that just the sight of his username now causes a downvote storm. I agree, and the gratuitous use of formatting does make reading hard. I've given him +1 on things where there seemed to be actual good advice, but I think the big
[Sinistral]: nail in coffin was the rant against a Schwarzian Transform
[stonecolddevin]: at best, from what i've seen, his knowledge is accurate up to maybe 2002. the sheer volume of words is mostly worthy of a downvote in most cases though i think
[erix]: ITYM Schwartzian Transform :P
[erix]: hey planetscape :)
[planetscape]: howdy stonecolddevin, erix
[Sinistral]: eric Aye. I thought I typed that wrong. All hail Randall! I listen to him on FLOSS Weekly
[Discipulus]: i think his vacuus, trombon like, absence of meaning, joined with a ostentatious style, after many years irritates the most
[erix]: easy to get wrong -- I guess that was sund's point, too :P

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2017-06-22 20:56 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (530 votes). Check out past polls.