Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Frequency table and frequencypolygon

by Anonymous Monk
on Oct 06, 2013 at 20:24 UTC ( #1057190=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi fellow Monks
I have an array of data:
1.45 3.29 1.63 4.31 6.78 0.44 0.51 6.91 3.32 8.59 3.63 -5.30 0.61 6.31 0 7.83 -0.76 -3.33 4.24 6.90 2.40 6.27 2.01 1.56 0.45 3.86 -3.49 2.54 1.66 2.19 0.57 1.78 5.22 2.35 0.82 -0.49 1.59 -3.45 -3.27 -0.16 3.86 0.29 9.63 3.38 3.43 1.54 -0.61 -4.28 1.20 -2.94 2.90 6.17 0.35 2.20 7.31 11.63 6.83 -0.25 17.28 -4.45 5.01

and I need to first create a frequency table from them (assign them in subgroups) and then create a frequency polygon.
Are there any ready-to-use modules for these things?

Comment on Frequency table and frequencypolygon
Download Code
Re: Frequency table and frequencypolygon
by kcott (Abbot) on Oct 06, 2013 at 21:13 UTC

    The frequency_distribution_ref() method of Statistics::Descriptive looks like it fits the bill for your frequency table.

    You'll need to provide more information about your frequency polygon. There's lots of modules for creating graphics: what format did you want? do you have special requirements? what else can you tell us that would help us help you?

    -- Ken

      I am up to here now:
      use Statistics::Descriptive; $stat = Statistics::Descriptive::Full->new(); $stat->add_data(1.45,3.29,1.63,4.31,6.78,0.44,0.51,6.91,3.32,8.59,3.63 +,-5.30,0.61,6.31,0,7.83,-0.76,-3.33,4.24,6.90,2.40,6.27,2.01,1.56,0.4 +5,3.86,-3.49,2.54,1.66,2.19,0.57,1.78,5.22,2.35,0.82,-0.49,1.59,-3.45 +,-3.27,-0.16,3.86,0.29,9.63,3.38,3.43,1.54,-0.61,-4.28,1.20,-2.94,2.9 +0,6.17,0.35,2.20,7.31,11.63,6.83,-0.25,17.28,-4.45,5.01); %f = $stat->frequency_distribution(5); for (sort {$a <=> $b} keys %f) { print "key = $_, count = $f{$_}\n"; }

      and I get:
      key = -0.784, count = 8 key = 3.732, count = 34 key = 8.248, count = 15 key = 12.764, count = 3 key = 17.28, count = 1

      How can I plot it now? I want something like:
      http://onlinestatbook.com/2/graphing_distributions/graphics/freq_poly. +jpg

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-07-07 02:52 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 (86 votes), past polls