Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: A lesson in statistics

by hangon (Deacon)
on Mar 20, 2007 at 04:27 UTC ( [id://605634]=note: print w/replies, xml ) Need Help??


in reply to A lesson in statistics

My statistics is a bit rusty, and tye has a better handle on what you're actually doing, but this might help. When working with statistics, you generally define a range of acceptable sample values, and any values outside of this range are discarded. These are called outliers. For example, below is your code modified to ignore the samples where po == 0, so they will not skew your results.

my $tlsamples = @series_po; # = @series_fr my $ok_samples = 0; my $sum_po = 0; my $sum_fr = 0; for (my $i; $i < $tlsamples; $i++){ # set up any conditions to skip outliers here if($series_po[$i] == 0){ next; } # count & sum only good samples $ok_samples++; $sum_po += $series_po[$i]; $sum_fr += $series_fr[$i]; } return 0 if ($ok_samples == 0); $sum_fr = 1 if ($sum_fr == 0); my $avg_po = $sum_po / $ok_samples; # =150 / 5 = 30 my $avg_fr = $sum_fr / $ok_samples; # = 10 / 5 = 2 $avg_fr = 1 (if $avg_fr == 0); # avoid div/0 my $pofr = $avg_po / $avg_fr; # = 15

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-29 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found