December 2017
Intermediate to advanced
386 pages
10h 42m
English
Run the following code in an execution cell:
from scipy.stats import gammadistr = gamma(2.0)xvalues = np.linspace(0, 10, 100)yvalues = distr.pdf(xvalues)plt.plot(xvalues, yvalues, color='orange')plt.title('Mean and median')plt.xlabel('$x$')plt.ylabel('$f(x)$')xmean = distr.mean()ymean = distr.pdf(xmean)xmed = distr.median()ymed = distr.pdf(xmed)aprops = dict(arrowstyle = '->')plt.annotate('Median={:3.2f}'.format(xmed), (xmed, ymed), (xmed+1, ymed+0.03), arrowprops=aprops)plt.annotate('Mean={:3.2f}'.format(xmean), (xmean, ymean), (xmean+1, ymean+0.03), arrowprops=aprops)comment = '''In a skewed distribution, mean and median usuallyhave different values.'''plt.text(4.5, 0.15, comment, fontsize=12, color='blue')None
Running ...
Read now
Unlock full access