Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: (contest) Help analyze PM reputation statistics

by tachyon (Chancellor)
on Sep 15, 2004 at 06:13 UTC ( [id://391094]=note: print w/replies, xml ) Need Help??


in reply to (contest) Help analyze PM reputation statistics

Here is a bit of code that does some basic graphing. Here is the graph. The moving averages all show the same thing. There is an unexpected data anomoly around 155-165 XP. Note I have jacked the moving averages up by 0.5 to separate them cleanly from the raw data.

#!/usr/bin/perl -w use GD::Graph; use GD::Graph::lines; use strict; my $OUTFILE = 'c:/file.png'; my %rep_stats=(1=>24694, 2=>23551, 0=>22855, 3=>21340, 4=>19598, 5=>17 +779, 6=>16575, 7=>15200, 8=>13695, 9=>12824, 10=>11722, 11=>10545, 12=>9829 +, 13=>8860, 14=>8022, 15=>7363, 16=>6692, 17=>6044, 18=>5465, 19=>5040, -1=>4747, 20=>4575, 21=>4101, 22=>3910, 23=>3494, 24=>3135, 25=>2702, 26=>2631, 27=>2364, 28=>2233, -2=>2174, 29=>2053, 30=>1823, 31=>1775, 32=>1606, 33=>1530, 34=>1397, 35=>1269, -3=>1237, 36=>1151, 37=>1144, 38=>1059, 39=>980, 40=>961, -4=>898, 41=>885, 43=>833, 42=>761, 44=>68 +6, 45=>685, 46=>663, 47=>652, 48=>589, 49=>564, -5=>551, 51=>494, 50=>478 +, 52=>474, 54=>444, -6=>444, 53=>429, 57=>400, 55=>393, 56=>355, 58=>322 +, 59=>321, 60=>310, 61=>286, -7=>283, 62=>266, -8=>261, 64=>243, 63=>223 +, 70=>216, 66=>215, 65=>212, 67=>211, -9=>206, 68=>194, -10=>190, 71=>18 +0, 69=>176, 72=>173, 74=>163, -11=>154, 76=>148, 73=>141, 75=>138, 77=>13 +5, -12=>134, 79=>120, 82=>120, -13=>114, 80=>109, 78=>106, -14=>106, 81=> +100, 83=>92, -16=>90, 85=>88, 89=>87, 84=>82, 87=>74, 90=>74, 88=>74, 91=>7 +2, 92=>71, 86=>68, -15=>66, 97=>63, 98=>60, 94=>59, -17=>57, -19=>55, 93= +>50, 96=>49, 102=>48, 105=>47, 95=>47, 99=>46, -20=>46, -18=>44, 109=>41, 101=>39, 100=>37, 104=>36, 116=>36, 111=>34, 103=>34, -22=>33, 108=>32 +, 107=>31, 106=>30, 112=>28, 121=>27, 113=>25, 110=>24, -29=>23, 120=>23 +, 117=>22, -21=>22, 118=>21, 122=>21, -23=>19, 125=>19, 129=>18, 115=>18 +, 126=>18, 132=>17, 114=>16, 124=>16, 123=>16, 128=>16, -25=>15, 137=>15 +, -26=>14, -28=>13, 136=>13, -32=>12, -24=>12, 119=>12, -27=>12, 127=>12 +, 135=>11, 143=>11, -33=>11, 139=>11, 134=>10, -38=>10, -31=>10, 146=>10 +, 138=>10, 133=>10, -34=>9, 142=>9, 160=>9, 145=>8, 164=>8, 131=>8, -53= +>7, 156=>7, 148=>7, 140=>7, 130=>7, 162=>7, 151=>6, 144=>6, -39=>6, -42=>6 +, -37=>6, 147=>6, 159=>6, -40=>6, -46=>5, 155=>5, 176=>5, 167=>5, -36=>5 +, 175=>5, 166=>5, -30=>5, 172=>4, 149=>4, 150=>4, 152=>4, 161=>4, 183=>4 +, -43=>4, 165=>4, -44=>4, 168=>4, 170=>4, 191=>4, 171=>4, -60=>3, -35=>3 +, 187=>3, 169=>3, 163=>3, 182=>3, -54=>3, -58=>3, -45=>3, 141=>3, -51=>3 +, 158=>2, -90=>2, 194=>2, 195=>2, 258=>2, 186=>2, 173=>2, 198=>2, 178=>2 +, 179=>2, -52=>2, -47=>2, -68=>2, 202=>2, -55=>2, -56=>2, 204=>2, -106=> +2, 180=>2, 215=>2, 217=>2, 153=>2, 154=>2, 228=>2, 254=>2, -48=>1, -49=>1 +, 322=>1, 288=>1, -82=>1, -83=>1, -84=>1, -88=>1, 253=>1, 327=>1, 181=>1 +, 292=>1, 328=>1, 293=>1, 255=>1, 184=>1, 188=>1, -50=>1, -223=>1, -57=> +1, 299=>1, -59=>1, -93=>1, 440=>1, 261=>1, 263=>1, 336=>1, 193=>1, 197=>1 +, 199=>1, -61=>1, -65=>1, -66=>1, -67=>1, 571=>1, 456=>1, 212=>1, 226=>1 +, 229=>1, 157=>1, 230=>1, 273=>1, 304=>1, 235=>1, 236=>1, 463=>1, 237=>1 +, 349=>1, 238=>1, 279=>1, -70=>1, -71=>1, 239=>1, -203=>1, 207=>1, 242=> +1, 243=>1, 245=>1, 174=>1, -41=>1, ); my (@reps, @counts, @percent1, @percent2, @ma, @ma2, @ma4, @ma8, @ma16 + ); my $total = 0; my $min = 0; for my $rep(sort { $a <=> $b } keys %rep_stats) { $min ||= $rep; $total += $rep_stats{$rep}; push @reps, $rep; } my $t = $total; my @ma = (0)x16; for my $rep(@reps) { push @counts, log($rep_stats{$rep})/log(10); push @percent1, 5*($t-$rep_stats{$rep})/$total; push @percent2, 5-$percent1[-1]; $t -= $rep_stats{$rep}; unshift @ma, $counts[-1]; pop @ma; push @ma2, calc_ma( \@ma, 2 ); push @ma4, calc_ma( \@ma, 4 ); push @ma8, calc_ma( \@ma, 8 ); push @ma16, calc_ma( \@ma, 16 ); } sub calc_ma { my ( $ma_ref, $num ) = @_; my $av = 0; for my $i(0..$num-1) { $av += $ma_ref->[$i]; } return 0.5+ $av/$num; } my $graph = GD::Graph::lines->new(1000,750); my @data = ( \@reps, \@counts, \@percent1, \@percent2, \@ma2, \@ma4, \@ma8, \@ma16, ); $graph->set_legend( 'Raw Count', 'Percent', 'Percent', 'Moving Average 2', 'Moving Average 4', 'Moving Average 8', 'Moving Average 16' ); $graph->set( x_label => 'Reputation', y_label => 'Node Count (log 10), Percent Nodes 5=100%', title => 'PM Stats', bgclr => 'white', y_max_value => 5, y_tick_number => 10, long_ticks => 1, x_label_skip => 10, legend_placement=> 'RC', dclrs => [ qw(gray black black yellow green blue red) ] ) or die $graph->error; my $gd = $graph->plot(\@data) or die $graph->error; open(IMG, ">$OUTFILE" ) or die $!; binmode IMG; print IMG $gd->png; close IMG;

cheers

tachyon

Replies are listed 'Best First'.
Re^2: (contest) Help analyze PM reputation statistics
by poqui (Deacon) on Sep 17, 2004 at 14:32 UTC
    Nice job!

    But I cannot run it... I am on a winders machine, and ActiveState doesnt have the GD package for some reason.

    I also don't have a c compiler to build it.

    Oh well, I will have to be contect to admire from afar...

    For now.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-19 23:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found