.. _book_fig_chapter3_fig_uniform_mean: Convergence of mean for uniformly distributed values ---------------------------------------------------- Figure 3.21. A comparison of the sample-size dependence of two estimators for the location parameter of a uniform distribution, with the sample size ranging from N = 100 to N =10,000. The estimator in the top panel is the sample mean, and the estimator in the bottom panel is the mean value of two extreme values. The theoretical 1-, 2-, and 3-sigma contours are shown for comparison. When using the sample mean to estimate the location parameter, the uncertainty decreases proportionally to 1/ N, and when using the mean of two extreme values as 1/N. Note different vertical scales for the two panels. The two methods of estimating the mean :math:`\mu` are: - :math:`\bar\mu = \mathrm{mean}(x)`, with an error that scales as :math:`1/\sqrt{N}`. - :math:`\bar\mu = \frac{1}{2}[\mathrm{max}(x) + \mathrm{min}(x)]`, with an error that scales as :math:`1/N`. The shaded regions on the plot show the expected 1, 2, and 3-:math:`\sigma` error. Notice the difference in scale between the y-axes of the two plots. .. image:: ../images/chapter3/fig_uniform_mean_1.png :scale: 100 :align: center .. raw:: html
**Code output:** .. raw:: html
.. literalinclude:: fig_uniform_mean.txt .. raw:: html
**Python source code:** .. raw:: html
.. literalinclude:: fig_uniform_mean.py :lines: 25- .. raw:: html
:download:`[download source: fig_uniform_mean.py] ` .. raw:: html