.. _book_fig_chapter3_fig_cauchy_median_mean: Median and Mean for Cauchy distribution --------------------------------------- Figure 3.12. The bottom panel shows a sample of N points drawn from a Cauchy distribution with :math:`\mu = 0` and :math:`\gamma=2`. The top panel shows the sample median, sample mean, and two robust estimates of the location parameter (see text) as a function of the sample size (only points to the left from a given sample size are used). Note that the sample mean is not a good estimator of the distribution's location parameter. Though the mean appears to converge as N increases, this is deceiving: because of the large tails in the Cauchy distribution, there is always a high likelihood of a far-flung point affecting the sample mean. This behavior is markedly different from a Gaussian distribution where the probability of such "outliers" is much smaller. .. image:: ../images/chapter3/fig_cauchy_median_mean_1.png :scale: 100 :align: center .. raw:: html
**Code output:** .. raw:: html
.. literalinclude:: fig_cauchy_median_mean.txt .. raw:: html
**Python source code:** .. raw:: html
.. literalinclude:: fig_cauchy_median_mean.py :lines: 17- .. raw:: html
:download:`[download source: fig_cauchy_median_mean.py] ` .. raw:: html