Created
October 30, 2013 23:30
-
-
Save drsnyder/7242091 to your computer and use it in GitHub Desktop.
Click rate estimation.
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
# Aapproximation for the 95th % of clicks per minute given a 25k click rate per | |
# day from viglink. | |
# Assumes that the click rate follows an exponential distribution where | |
# the per-unit time we are using is 1min. | |
viglink.clickrate = 25000 # day | |
rate.min.u = viglink.clickrate/24/60 # min | |
print("rate per minute") | |
rate.min.u | |
# mean of exponential distribution is u = 1/lambda, lambda = 1/u | |
rate.param = 1/rate.min.u | |
# take a sample | |
ctr.sample = rexp(1e6,rate.param) | |
# what does the distribution look like? | |
print("summary of sample") | |
summary(ctr.sample) | |
sample.means = replicate(100, { | |
ctr.sample = rexp(1e6,rate.param) | |
# take the 95th % | |
sort(ctr.sample)[as.integer(length(ctr.sample)*0.95)] | |
}) | |
summary(sample.means) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment