Company twitter and the Pareto principle
From wikipedia: “The Pareto principle (also known as the 80-20 rule,[1] the law of the vital few, and the principle of factor sparsity) states that, for many events, roughly 80% of the effects come from 20% of the causes.”
I’ve always liked the 80-20 rule, because it seems to be such a consistent rule of thumb when dealing with people, who you would assume would be more random.
So recently we had our company update, and a chart was put up showing who in the company are the biggest tweeters, which made me wonder how closely that data would follow the 80-20 rule, given how small the sample size is. So here we go.
First the code. I think it would have taken me longer to find someone elses program that does this than it took me to write it:
First the code:
require 'rubygems'
require 'twitter'
require 'terminal-table/import'
def percentage(tweets)
"%.2f" % (tweets.to_f/@total_tweets*100) + '%'
end
httpauth = Twitter::HTTPAuth.new('C3Beau', 'xxxxxxxx')
client = Twitter::Base.new(httpauth)
c3users = client.followers << client.user('C3Beau')
tweet_counts = c3users.collect {|user| user[:statuses_count]}
@total_tweets = tweet_counts.inject(0) {|sum,count| sum + count }
c3users.sort! {|a,b| a[:statuses_count] <=> b[:statuses_count] }
output_table = c3users.collect do |user|
[
user[:screen_name],
user[:statuses_count],
percentage(user[:statuses_count])
]
end
puts table(['user','tweets','percentage'],*output_table)
Next the output:
+-----------+--------+------------+
| user | tweets | percentage |
+-----------+--------+------------+
| C3Burgo | 0 | 0.00% |
| C3Krishni | 0 | 0.00% |
| C3Sreyna | 1 | 0.07% |
| c3deepika | 1 | 0.07% |
| C3Seanc | 1 | 0.07% |
| C3Blair | 4 | 0.29% |
| C3Zelman | 4 | 0.29% |
| C3Kathy | 5 | 0.36% |
| C3Tony | 9 | 0.65% |
| C3Rob | 11 | 0.79% |
| C3SimonC | 13 | 0.94% |
| C3Tara | 22 | 1.59% |
| C3Tim | 28 | 2.02% |
| C3Sumo | 38 | 2.74% |
| C3ChrisM | 74 | 5.33% |
| C3Jodie | 83 | 5.98% |
| C3Tak | 93 | 6.70% |
| C3Mark | 104 | 7.49% |
| C3Michael | 105 | 7.56% |
| C3Cameron | 159 | 11.46% |
| C3Beau | 169 | 12.18% |
| C3Conrad | 204 | 14.70% |
| C3Alister | 260 | 18.73% |
+-----------+--------+------------+
So, working from highest to lowest until we get to around 80% we go.. 18.73+14.70+12.18+11.46+7.56+7.49+6.70 = 78.82%
That got us from C3Alister to C3Tak. 7 People, out of a sample size of 23 giving us… 30%. Ha, considering there’s only 23 people in the group I reckon that’s pretty good.
Note: All of those accounts are protected, so I figure I’m safe in listing them like that.