Skip to content

Instantly share code, notes, and snippets.

@davidrichards
Last active June 29, 2016 17:44
Show Gist options
  • Save davidrichards/4b163979e9b32ecd536411bf2f22db61 to your computer and use it in GitHub Desktop.
Save davidrichards/4b163979e9b32ecd536411bf2f22db61 to your computer and use it in GitHub Desktop.
We had some data on the response time of some code after we deployed a speed up and we wanted to know if it was fast enough. The numbers I have below are in milliseconds, and we have to deliver under 1 second. I used Python for my work, this is a Ruby version of the same. Requires the distribution gem to be installed.
mu = 522 # mean observation
max = 859 # max observation, assumed 2 standard deviations above the mean
std = (max - mu) / 2.0 # standard deviation
z = (1000 - mu) / std # 1,000 is when we have a problem, so what is the z-score of a problem?
p = Distribution::Normal.cdf(z) # get the probability of this event
# Python version of the same is: p = stats.norm.cdf(z)
1 - p # The probability of having a problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment