Skip to content

Instantly share code, notes, and snippets.

@xnzac
Created September 20, 2011 18:47
Show Gist options
  • Save xnzac/1229941 to your computer and use it in GitHub Desktop.
Save xnzac/1229941 to your computer and use it in GitHub Desktop.
R function for calculating A/B testing sample size from Ian Clarke(of 37signals)'s
# ref: http://37signals.com/svn/posts/3004-ab-testing-tech-note-determining-sample-size
#
# p1 = Variable A results. e.g. conversion rate from test A
# p2 = Variable B results
# power = chance of false negative (A power of 0.80 means that there is an 80% chance that if there was an effect, we would detect it )
# sig.level = chance of false positive (0.05 = 5%)
power.prop.test(p1=0.1, p2=0.11, power=0.8, alternative='two.sided', sig.level=0.05)
# Output will be a number signifying minimal sample size that meets the above criteria
@georgebullock
Copy link

Thanks for uploading this Zach!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment