Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Statistical data analysis

by Anonymous Monk
on Jun 05, 2002 at 17:31 UTC ( #171926=note: print w/ replies, xml ) Need Help??


in reply to Statistical data analysis

Your method of calculating variance can result in loss of significant digits. For example, the following data produces a variance of 0 for X on my machine (causing div-by-zero errors later). The variance should be the same for both X and Y (as the data differs only by a constant).

999999997	9999997
999999998	9999998
999999999	9999999

Better results may be achieved by "centering" your variance calculation about the mean.

my $VX = 0; $VX += ($_ - $MX)**2 for @x; $VX /= $Xn;

You are also making far more passes over the data than necessary.


Comment on Re: Statistical data analysis
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://171926]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2015-07-29 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls