Skip to content

Instantly share code, notes, and snippets.

@johnmyleswhite
Created May 25, 2018 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmyleswhite/a4ea9aeac99c67afe6dd592a7e7228fe to your computer and use it in GitHub Desktop.
Save johnmyleswhite/a4ea9aeac99c67afe6dd592a7e7228fe to your computer and use it in GitHub Desktop.
using Distributions
using PyPlot
ϵ = 0.0001
n_grid = 10_000
ps = linspace(ϵ, 1 - ϵ, n_grid)
ss = [std(Bernoulli(p)) for p in ps]
sks = [skewness(Bernoulli(p)) for p in ps]
pl = plot(ps, ss)
xlabel("p")
ylabel("Standard Deviation of Bernoulli(p)")
pl = plot(ps, sks)
xlabel("p")
ylabel("Skewness of Bernoulli(p)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment