Created
June 12, 2009 18:42
-
-
Save abscondment/128830 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Combining Tony Wright's post on startup acquisition rate (http://is.gd/101m1) | |
and Evan Miller's post on statistical significance in percentage ratings | |
(http://bit.ly/19CJAd). | |
Results: | |
{"CA"=>[2739, 188, "5.98%"], | |
"NY"=>[692, 34, "3.54%"], | |
"MA"=>[386, 20, "3.38%"], | |
"TX"=>[323, 19, "3.80%"], | |
"WA"=>[317, 26, "5.66%"], | |
"FL"=>[254, 3, "0.40%"], | |
"NJ"=>[227, 8, "1.80%"], | |
"IL"=>[180, 9, "2.65%"], | |
"VA"=>[164, 7, "2.08%"], | |
"CO"=>[133, 7, "2.57%"], | |
"PA"=>[131, 2, "0.42%"], | |
"GA"=>[117, 2, "0.47%"], | |
"MD"=>[94, 4, "1.67%"], | |
"NC"=>[80, 1, "0.22%"], | |
"AZ"=>[77, 1, "0.23%"]} | |
Script to calculate these results: | |
NB: script requires statistics2 gem, which can be found at | |
http://github.com/abscondment/statistics2 and installed like so: | |
$ gem sources -a http://gems.github.com (you only have to do this once) | |
$ sudo gem install abscondment-statistics2 | |
#!/usr/bin/ruby | |
require 'pp' | |
require 'statistics2' | |
def ci_lower_bound(pos, n, power=0.05) | |
if n == 0 | |
return 0 | |
end | |
z = Statistics2.pnormaldist(1-power/2) | |
phat = 1.0*pos/n | |
(phat + z*z/(2*n) - z * Math.sqrt((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n) | |
end | |
results = %{ | |
CA 2739 41.2% 188 53.3% 6.9% | |
NY 692 10.4% 34 9.6% 4.9% | |
MA 386 5.8% 20 5.7% 5.2% | |
TX 323 4.9% 19 5.4% 5.9% | |
WA 317 4.8% 26 7.4% 8.2% | |
FL 254 3.8% 3 0.8% 1.2% | |
NJ 227 1.8% 8 2.3% 6.6% | |
IL 180 2.7% 9 2.5% 5.0% | |
VA 164 2.5% 7 2.0% 4.3% | |
CO 133 2.0% 7 2.0% 5.3% | |
PA 131 2.0% 2 0.6% 1.5% | |
GA 117 1.8% 2 0.6% 1.7% | |
MD 94 1.4% 4 1.1% 4.3% | |
NC 80 1.2% 1 0.3% 1.2% | |
AZ 77 1.2% 1 .3% 1.3% | |
}.split(/\n/).reject!{|l| l.gsub(/[\s]+/,'').empty?} | |
results = results.inject({}) { | |
|h,l| | |
l = l.split | |
h[l[0]] = [l[1].to_i, l[3].to_i, sprintf("%.2f%%", 100.0 * ci_lower_bound(l[3].to_f, l[1].to_f))] | |
h | |
} | |
pp results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment