<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/some-notes-on-the-cauchy-distribution/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.rstudio.com/rviews/2017/02/15/some-notes-on-the-cauchy-distribution/"> RStudio</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>

<p>by Joseph Rickert</p>
<p>I have always been attracted to the capricious. So, it was no surprise that I fell for the <a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Cauchy_distribution">Cauchy distribution</a> at first sight. I had never seen such unpredictability! You might say that every distribution has its moments of unpredictability, but the great charm of Cauchy is that it has no moments. (No finite moments, anyway.)</p>
<p>Before discussing why momentlessness (not being in the moment <img alt="🙂" class="wp-smiley" src="https://i0.wp.com/s.w.org/images/core/emoji/2/72x72/1f642.png?w=456&ssl=1" data-recalc-dims="1"> ) leads to unpredictability, let’s derive the Cauchy distribution. A common conceit for doing this is to consider a blindfolded archer trying to hit a target directly in front of him. He randomly shoots towards the wall at an angle <em>θ</em> that can sometimes be so large he shoots parallel to the wall!</p>
<p>Where on the wall is any given arrow likely to land? The following diagram maps out the situation.<br>
<img alt="" src="https://i2.wp.com/www.rstudio.com/wp-content/uploads/2017/02/Archer.png?w=456" data-recalc-dims="1"></p>
<p>The archer is standing at the point (0, 0). The point on the wall directly in front of him is (x, 0), and the arrow will land at (x, y), (x, -y), or not at all. After changing to polar coordinates, a moments reflection will give you the equation <em>y = xtan(θ)</em>.</p>
<p>Assuming that theta is uniformly distributed on the interval <em>I = (- π/2, π/2)</em>, a direct substitution into the equation for the CDF of the uniform distribution will yield the CDF for the Cauchy distribution. </p>
<p><iframe height="50px" width="1000px" src="https://beta.rstudioconnect.com/content/2518/cauchy_block1.html"></iframe></p>
<p>Differentiating this gives the Cauchy density function: </p>
<p><iframe height="70px" width="1000px" src="https://beta.rstudioconnect.com/content/2520/cauchy_block2.html"></iframe></p>
<p>This looks tame, but a short argument showing that the <a target="_blank" rel="nofollow" href="https://www.youtube.com/watch?v=Q7n7EPacAu8">necessary integrals do not converge</a> demonstrates that neither the mean nor the variance exist. Hence, neither the Law of Large Numbers, nor the Central Limit Theorem apply. Taking lots of samples and computing averages doesn’t buy you anything. The averages just don’t settle down. This behavior is apparent in the following simulation that computes means of Cauchy samples for sample sizes of one to five thousand. The plots that show the same data at different scales dramatize the erratic behavior. </p>
<p><iframe height="1350px" width="1000px" src="https://beta.rstudioconnect.com/content/2521/cauchy_block3.html"></iframe></p>
<p>Not only don’t the samples converge, it is not that difficult to show that the distribution of the sample mean:</p>
<p><iframe height="70px" width="1000px" src="https://beta.rstudioconnect.com/content/2522/cauchy_block4.html"></iframe></p>
<p>of n independent Cauchy random variables has the same distribution as a single Cauchy random variable! The proof is straightforward. Let <em>φ(t)</em> be the characteristic function. Then </p>
<p><iframe height="50px" width="1000px" src="https://beta.rstudioconnect.com/content/2523/cauchy_block5.html"></iframe></p>
<p>which is the characteristic function of nY.</p>
<p>The extreme values that dominate the Cauchy distribution make it the prototypical heavy-tailed distribution. Informally, a distribution is often described as having heavy or “fat” tails if the probability of events in the tails of the distribution are greater than what would be given by a Normal distribution. While there seems to be more than one formal definition of a [heavy-tailed distribution] (https://en.wikipedia.org/wiki/Heavy-tailed_distribution), the following diagram, which compares the right tails of the Normal, Exponential and Cauchy distributions, gets the general idea across.</p>
<p><iframe height="690px" width="1000px" src="https://beta.rstudioconnect.com/content/2524/cauchy_block6.html"></iframe></p>
<p>As exotic as the Cauchy distribution may seem, it is not all that difficult to come face-to-face with the Cauchy Distribution in every-day modeling work. A student t distribution with one degree of freedom is Cauchy, as is the <a target="_blank" rel="nofollow" href="http://www.math.wm.edu/~leemis/chart/UDR/PDFs/StandardnormalStandardcauchy.pdf">ratio of two independent standard normal random variables</a>.</p>
<p>Additionally, the Cauchy distribution, also called the Breit-Wigner, or Lorentz distribution, has applications in <a target="_blank" rel="nofollow" href="http://www.hep.phy.cam.ac.uk/~thomson/lectures/partIIIparticles/Handout14_2009.pdf">particle physics</a>, <a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Spectral_line_shape#Line_shape_functions">spectroscopy</a>, <a target="_blank" rel="nofollow" href="http://www.scienpress.com/Upload/TMA/Vol%201_1_7.pdf">finance</a>, and medicine. In his 2006 <a target="_blank" rel="nofollow" href="file:/Users/JBRickert/Downloads/v16i04.pdf">JSS paper</a>, Geroge Marsaglia elaborates on early work he did on transforming the ratio of two jointly Normal random variables into something tractable. The original problem arose from an attempt to estimate the intercept in a linear model giving the life span of red blood cells.</p>
<p>The real fun, and maybe the real world, seems to happen when things are not normal.</p>
<h2>Further Reading</h2>
<ul>
<li>
<p>The <a target="_blank" rel="nofollow" href="https://www.crcpress.com/Introduction-to-Probability-with-R/Baclawski/p/book/9781420065213">Introduction to Probability with R</a> by Kenneth Baclawski, based on a course he developed with Gian-Carlo Rota, is a delightful introduction to probability theory. The idea of plotting the sample means above comes from Section 5.7 of this book.</p>
</li>
<li>
<p>For some good reading on heavy-tailed distributions, have a look at the extended presentation on the <a target="_blank" rel="nofollow" href="http://users.cms.caltech.edu/~adamw/papers/2013-SIGMETRICS-heavytails.pdf">Fundamentals of Heavy Tails</a> by Nair et al.; <a target="_blank" rel="nofollow" href="http://www.springer.com/cda/content/document/cda_downloaddocument/9781461487876-c1.pdf?SGWID=0-0-45-1443310-p175370772">Chapter 2</a> of <a target="_blank" rel="nofollow" href="http://www.springer.com/us/book/9781461487876">The Statistical Analysis of Financial Data in R</a>; and <a target="_blank" rel="nofollow" href="http://www.springer.com/cda/content/document/cda_downloaddocument/9781461471004-c1.pdf?SGWID=0-0-45-1395304-p175250259">Chapter 2</a> of <a target="_blank" rel="nofollow" href="http://www.springer.com/us/book/9781461471004#otherversion=9781489988324">An Introduction to Heavy-Tailed and Sucexponential Distributions</a> by Foss et al.</p>
</li>
<li>
<p>For a sophisticated but accessible look at general Stable Distributions, have a look at this <a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Heavy-tailed_distribution">recent paper</a> on Stable Distributions, by John Nolan. </p>
</li>
</ul>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.rstudio.com/rviews/2017/02/15/some-notes-on-the-cauchy-distribution/"> RStudio</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/QZb1yVIbXKA"></a></div>