Sample Size Table

node v0.12.18
version: 1.0.1
endpointsharetweet
var d3 = require("d3-format"); var f = d3.format(",.1%"), samples = [ 50, 100, 200, 400, 500, 700, 1000, 1300, 1500, 2500, 5000 ]; function se68(p, n) { p = parseFloat(p); return Math.sqrt(p * (1-p) / n); } function se95(p, n) { return se68(p, n) * 1.96; } function se98(p, n) { return se68(p, n) * 2.33; } function se99(p, n) { return se68(p, n) * 2.575; } samples.map(function(d) { return { "sample" : d, "95" : f(se95(.5, d)), "98" : f(se98(.5, d)), "99" : f(se99(.5, d)) }; });
Loading…

no comments

    sign in to comment