<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Rolling dice for normal samples</title>
	<atom:link href="http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/</link>
	<description>The blog of John D. Cook</description>
	<lastBuildDate>Sat, 11 Feb 2012 01:10:06 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Sean</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-103585</link>
		<dc:creator>Sean</dc:creator>
		<pubDate>Thu, 15 Sep 2011 21:24:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-103585</guid>
		<description>&quot;It is probably worth mentioning here that all of the usual methods of generating Normal random variables are approximations to some degree.&quot;

The Box-Muller transformation of two uniform random variables actually gives a true normal distribution--provided you have a decent way of generating random numbers in the interval from 0 to 1. It&#039;s a pretty elegant trick based on a polar transformation of a bivariate normal distribution: if X and Y are uniformly distributed random variables in [0,1], then 

Z = sqrt(-2*ln(X))*cos(2*pi*Y)

is a standard normal random variable.  The Mathworld article is here:
&lt;a href=&quot;http://mathworld.wolfram.com/Box-MullerTransformation.html&quot; rel=&quot;nofollow&quot;&gt;http://mathworld.wolfram.com/Box-MullerTransformation.html&lt;/a&gt;.  And here is an online calculator that produces normally distributed random variables (with links to other random generators):  &lt;a href=&quot;http://www.had2know.com/academics/gaussian-normal-random-generator.html&quot; rel=&quot;nofollow&quot;&gt;http://www.had2know.com/academics/gaussian-normal-random-generator.html&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>&#8220;It is probably worth mentioning here that all of the usual methods of generating Normal random variables are approximations to some degree.&#8221;</p>
<p>The Box-Muller transformation of two uniform random variables actually gives a true normal distribution&#8211;provided you have a decent way of generating random numbers in the interval from 0 to 1. It&#8217;s a pretty elegant trick based on a polar transformation of a bivariate normal distribution: if X and Y are uniformly distributed random variables in [0,1], then </p>
<p>Z = sqrt(-2*ln(X))*cos(2*pi*Y)</p>
<p>is a standard normal random variable.  The Mathworld article is here:<br />
<a href="http://mathworld.wolfram.com/Box-MullerTransformation.html" rel="nofollow">http://mathworld.wolfram.com/Box-MullerTransformation.html</a>.  And here is an online calculator that produces normally distributed random variables (with links to other random generators):  <a href="http://www.had2know.com/academics/gaussian-normal-random-generator.html" rel="nofollow">http://www.had2know.com/academics/gaussian-normal-random-generator.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-50586</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 04 Nov 2010 10:04:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-50586</guid>
		<description>Here are the buzz words I think you need to find what you&#039;re looking for: asymptotic distribution of order statistics. For example, if you look at the sample median, it does indeed become progressively more normal as the sample size n increases. In fact sqrt(n)*(sample median - mean) is asymptotically normal with mean 0 and variance 1 / (2 f(mean))^2 where f is the PDF of the distribution you&#039;re sampling from. This comes from Casella and Berger&#039;s book &lt;em&gt;Statistical Inference&lt;/em&gt;, 2nd edition, page 484.  Casella and Berger say to see &lt;em&gt;Mathematical Statistics&lt;/em&gt; by J. Shao for a more general result.</description>
		<content:encoded><![CDATA[<p>Here are the buzz words I think you need to find what you&#8217;re looking for: asymptotic distribution of order statistics. For example, if you look at the sample median, it does indeed become progressively more normal as the sample size n increases. In fact sqrt(n)*(sample median &#8211; mean) is asymptotically normal with mean 0 and variance 1 / (2 f(mean))^2 where f is the PDF of the distribution you&#8217;re sampling from. This comes from Casella and Berger&#8217;s book <em>Statistical Inference</em>, 2nd edition, page 484.  Casella and Berger say to see <em>Mathematical Statistics</em> by J. Shao for a more general result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paolo</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-50584</link>
		<dc:creator>Paolo</dc:creator>
		<pubDate>Thu, 04 Nov 2010 09:38:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-50584</guid>
		<description>Hi John,

I ran into your webpage and I have a question, I hope you can help.
I am trying to find an equation that describe the probability of the following event:

We have 10 cards (nmbered from 1 to 10) and these cards are shuffled and then leid out in random order. ie the first time we could get 3, 6, 5, 7, 8, 10, 9, 2, 1, 4 and and different order for the second time.  Each card is then given a rank according to the order in which they appear (in the example above, card 3 is 1st). 
If one does that a number of times (eg 100),  one can see that the average rank of each card has a mean of 5.5 and the distribution of these means is normal. The shape of the normal distribution gets narrower and narrowed the more events are carried out.  There must be a function that describes this normal distrbution based on the number of cards and the number of shuffling events. I hope you can help, and /or maybe direct us to a reference (book or article) as a source of information.</description>
		<content:encoded><![CDATA[<p>Hi John,</p>
<p>I ran into your webpage and I have a question, I hope you can help.<br />
I am trying to find an equation that describe the probability of the following event:</p>
<p>We have 10 cards (nmbered from 1 to 10) and these cards are shuffled and then leid out in random order. ie the first time we could get 3, 6, 5, 7, 8, 10, 9, 2, 1, 4 and and different order for the second time.  Each card is then given a rank according to the order in which they appear (in the example above, card 3 is 1st).<br />
If one does that a number of times (eg 100),  one can see that the average rank of each card has a mean of 5.5 and the distribution of these means is normal. The shape of the normal distribution gets narrower and narrowed the more events are carried out.  There must be a function that describes this normal distrbution based on the number of cards and the number of shuffling events. I hope you can help, and /or maybe direct us to a reference (book or article) as a source of information.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Math Teachers at Play #2 &#171; Let&#8217;s Play Math!</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-14192</link>
		<dc:creator>Math Teachers at Play #2 &#171; Let&#8217;s Play Math!</dc:creator>
		<pubDate>Fri, 06 Mar 2009 11:05:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-14192</guid>
		<description>[...] D. Cook looks at Rolling dice for normal samples. And be sure to check out the 50th Carnival of Mathematics, hosted at John&#8217;s blog The [...]</description>
		<content:encoded><![CDATA[<p>[...] D. Cook looks at Rolling dice for normal samples. And be sure to check out the 50th Carnival of Mathematics, hosted at John&#8217;s blog The [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gb</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13981</link>
		<dc:creator>gb</dc:creator>
		<pubDate>Mon, 02 Mar 2009 06:51:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13981</guid>
		<description>Oh, sorry, I see it&#039;s already discussed. My apologies.</description>
		<content:encoded><![CDATA[<p>Oh, sorry, I see it&#8217;s already discussed. My apologies.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gb</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13980</link>
		<dc:creator>gb</dc:creator>
		<pubDate>Mon, 02 Mar 2009 06:50:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13980</guid>
		<description>(maybe a continuity-correction issue?)</description>
		<content:encoded><![CDATA[<p>(maybe a continuity-correction issue?)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gb</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13979</link>
		<dc:creator>gb</dc:creator>
		<pubDate>Mon, 02 Mar 2009 06:28:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13979</guid>
		<description>Why are the errors asymmetric about the mean?</description>
		<content:encoded><![CDATA[<p>Why are the errors asymmetric about the mean?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EastwoodDC</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13200</link>
		<dc:creator>EastwoodDC</dc:creator>
		<pubDate>Wed, 11 Feb 2009 23:36:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13200</guid>
		<description>That makes sense, I should not have had the expectation of symmetry. 
Now that I think on it a bit longer, the asymmetry is small enough that I had real doubt, which also saying something about how well this simple approximation works.</description>
		<content:encoded><![CDATA[<p>That makes sense, I should not have had the expectation of symmetry.<br />
Now that I think on it a bit longer, the asymmetry is small enough that I had real doubt, which also saying something about how well this simple approximation works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13199</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 11 Feb 2009 22:58:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13199</guid>
		<description>You are correct: the difference between the two distributions is asymmetric.  This is because one distribution is discrete and one is continuous.

Imagine the density for the dice. Half of the probability is for rolls between 5 and 17, the other half between 18 and 30. So the CDF of the discrete dice distribution reaches 1/2 at 17, but the CDF of the continuous normal distribution reaches 1/2 at 17.5.  Or think about the end. The CDF of the discrete distribution reaches 1 at 30, but the CDF of the normal is only 1 in the limit. So the discrete distribution is a little bit ahead of the continuous distribution.</description>
		<content:encoded><![CDATA[<p>You are correct: the difference between the two distributions is asymmetric.  This is because one distribution is discrete and one is continuous.</p>
<p>Imagine the density for the dice. Half of the probability is for rolls between 5 and 17, the other half between 18 and 30. So the CDF of the discrete dice distribution reaches 1/2 at 17, but the CDF of the continuous normal distribution reaches 1/2 at 17.5.  Or think about the end. The CDF of the discrete distribution reaches 1 at 30, but the CDF of the normal is only 1 in the limit. So the discrete distribution is a little bit ahead of the continuous distribution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EastwoodDC</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13193</link>
		<dc:creator>EastwoodDC</dc:creator>
		<pubDate>Wed, 11 Feb 2009 20:57:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13193</guid>
		<description>Is it my imagination, or does that distribution of the differences look asymmetric? 
It&#039;s been a long time since I thought about generating functions. You have made me get my battered copy of Cassela-Berger down off the shelf, again! ;-)</description>
		<content:encoded><![CDATA[<p>Is it my imagination, or does that distribution of the differences look asymmetric?<br />
It&#8217;s been a long time since I thought about generating functions. You have made me get my battered copy of Cassela-Berger down off the shelf, again! <img src='http://www.johndcook.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13155</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 11 Feb 2009 00:09:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13155</guid>
		<description>Here&#039;s an interesting empirical test of a random number generator: how many samples would it take before a goodness of fit test could reject the hypothesis that the samples came from the theoretical distribution? 

I tried this with the K-S test, but unfortunately the fact that the dice generator only has 26 possible values throws the test off: samples from a continuous distribution are not supposed to have repeats.</description>
		<content:encoded><![CDATA[<p>Here&#8217;s an interesting empirical test of a random number generator: how many samples would it take before a goodness of fit test could reject the hypothesis that the samples came from the theoretical distribution? </p>
<p>I tried this with the K-S test, but unfortunately the fact that the dice generator only has 26 possible values throws the test off: samples from a continuous distribution are not supposed to have repeats.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Venier</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13154</link>
		<dc:creator>John Venier</dc:creator>
		<pubDate>Wed, 11 Feb 2009 00:01:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13154</guid>
		<description>Exactly so!  Also, when using electronics it is almost always the case that (pseudo-)random values from the standard uniform distribution are available even if for no other distribution.  Depending on your application, having something fast and easy and almost normally distributed can often be good enough.  It is probably worth mentioning here that &lt;strong&gt;all&lt;/strong&gt; of the usual methods of generating Normal random variables are approximations to some degree.

Another point probably worth mentioning is that the values generated by this method cannot exceed 6 in absolute value, even in theory.  But the theoretical probability of a Normal r.v. being outside of  (- 6,6) is about 2 per thousand million.  And having bounded values is not necessarily bad.</description>
		<content:encoded><![CDATA[<p>Exactly so!  Also, when using electronics it is almost always the case that (pseudo-)random values from the standard uniform distribution are available even if for no other distribution.  Depending on your application, having something fast and easy and almost normally distributed can often be good enough.  It is probably worth mentioning here that <strong>all</strong> of the usual methods of generating Normal random variables are approximations to some degree.</p>
<p>Another point probably worth mentioning is that the values generated by this method cannot exceed 6 in absolute value, even in theory.  But the theoretical probability of a Normal r.v. being outside of  (- 6,6) is about 2 per thousand million.  And having bounded values is not necessarily bad.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13145</link>
		<dc:creator>John</dc:creator>
		<pubDate>Tue, 10 Feb 2009 19:39:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13145</guid>
		<description>Regarding John Venier&#039;s comment above, note why 12 is special. Not just because it&#039;s a large number. 20 is even bigger, for example, but would not work.

The variance of a uniform[0,1] random variable is 1/12. So adding 12 together makes the variance 1. That&#039;s why his trick produces a &lt;b&gt;standard&lt;/b&gt; random sample.</description>
		<content:encoded><![CDATA[<p>Regarding John Venier&#8217;s comment above, note why 12 is special. Not just because it&#8217;s a large number. 20 is even bigger, for example, but would not work.</p>
<p>The variance of a uniform[0,1] random variable is 1/12. So adding 12 together makes the variance 1. That&#8217;s why his trick produces a <b>standard</b> random sample.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Venier</title>
		<link>http://www.johndcook.com/blog/2009/02/10/rolling-dice-for-normal-samples/comment-page-1/#comment-13143</link>
		<dc:creator>John Venier</dc:creator>
		<pubDate>Tue, 10 Feb 2009 19:01:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1464#comment-13143</guid>
		<description>A similar example I always thought was extremely clever was to add together 12 independent standard uniforms and subtract 6 from the sum.  It does a great job of approximating a standard normal and requires no division.

</description>
		<content:encoded><![CDATA[<p>A similar example I always thought was extremely clever was to add together 12 independent standard uniforms and subtract 6 from the sum.  It does a great job of approximating a standard normal and requires no division.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.382 seconds -->

