<?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: R: Clash of the cannon cycles</title>
	<atom:link href="http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/</link>
	<description>In Monte Carlo We Trust</description>
	<lastBuildDate>Sun, 08 Jan 2012 03:21:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Pierre</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-12159</link>
		<dc:creator>Pierre</dc:creator>
		<pubDate>Wed, 17 Nov 2010 16:26:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-12159</guid>
		<description>Hi,
As part of a code I&#039;m writing to study seismic fault orientations, I had to generate a set of random segments ( each x,y coordinate of each segment tip being drawn from an uniform distribution so that they all lie within the square). Then I divided the square in square cells and counted, for each cell, the number of rays passing through it. This gives me a density map. For some reason, I was expecting an uniform coverage of that square surface, but it turned out that I obtained a distribution which definitely looks like the one you obtain in your experiment, without the peaks on each edge of the square though. The density function I obtain exhibits a slight bulge, with a maximum density in the middle of the square, and minimum densities close to the square&#039;s edges. The main difference between my experiment and yours is that my segments start and end anywhere within the square, and not only on its edges. I also think we&#039;re not exactly counting the same thing : counting the number of times a cell is hit by a segment is actually a bit different from counting the number of times segments have intersected each other within that particular cell (for instance three parallel segments can hit a cell, but they don&#039;t intersect each other). I have to say that  I was a bit puzzled by such a distribution and that&#039;s how, after a little bit of time wandering on the web, I ended up on this page. And I have a question : is there a way to get an analytic estimate of the shape of such a density function?</description>
		<content:encoded><![CDATA[<p>Hi,<br />
As part of a code I&#8217;m writing to study seismic fault orientations, I had to generate a set of random segments ( each x,y coordinate of each segment tip being drawn from an uniform distribution so that they all lie within the square). Then I divided the square in square cells and counted, for each cell, the number of rays passing through it. This gives me a density map. For some reason, I was expecting an uniform coverage of that square surface, but it turned out that I obtained a distribution which definitely looks like the one you obtain in your experiment, without the peaks on each edge of the square though. The density function I obtain exhibits a slight bulge, with a maximum density in the middle of the square, and minimum densities close to the square&#8217;s edges. The main difference between my experiment and yours is that my segments start and end anywhere within the square, and not only on its edges. I also think we&#8217;re not exactly counting the same thing : counting the number of times a cell is hit by a segment is actually a bit different from counting the number of times segments have intersected each other within that particular cell (for instance three parallel segments can hit a cell, but they don&#8217;t intersect each other). I have to say that  I was a bit puzzled by such a distribution and that&#8217;s how, after a little bit of time wandering on the web, I ended up on this page. And I have a question : is there a way to get an analytic estimate of the shape of such a density function?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RF</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-3372</link>
		<dc:creator>RF</dc:creator>
		<pubDate>Wed, 04 Aug 2010 21:22:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-3372</guid>
		<description>Nice problem! Still thinking about the spatial distribution...

There&#039;s a really quick way to get the 17/36 figure with no integration (sorry if this is a repeat comment) --- first find the probabilities that the endpoints are on a certain configuration of sides; and then for any given configuration of sides, you can see that the probability of collision is always either 0, 1, or 1/2.</description>
		<content:encoded><![CDATA[<p>Nice problem! Still thinking about the spatial distribution&#8230;</p>
<p>There&#8217;s a really quick way to get the 17/36 figure with no integration (sorry if this is a repeat comment) &#8212; first find the probabilities that the endpoints are on a certain configuration of sides; and then for any given configuration of sides, you can see that the probability of collision is always either 0, 1, or 1/2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Asher</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-3019</link>
		<dc:creator>Matt Asher</dc:creator>
		<pubDate>Fri, 23 Jul 2010 15:11:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-3019</guid>
		<description>@xi&#039;an

It&#039;s certainly possible to generate a histogram that looks a lot like the final one using a mixture of Betas. Just playing around I came up with this:

hist(c(rbeta(100000,.5,.5),rbeta(20000,3.5,3.5)),breaks=100,col=&quot;blue&quot;)

which looks much like the final histogram. Though I suppose you could have &quot;mixed in&quot; just about any symmetric, unimodal distribution to get the small hump in the middle.</description>
		<content:encoded><![CDATA[<p>@xi&#8217;an</p>
<p>It&#8217;s certainly possible to generate a histogram that looks a lot like the final one using a mixture of Betas. Just playing around I came up with this:</p>
<p>hist(c(rbeta(100000,.5,.5),rbeta(20000,3.5,3.5)),breaks=100,col=&#8221;blue&#8221;)</p>
<p>which looks much like the final histogram. Though I suppose you could have &#8220;mixed in&#8221; just about any symmetric, unimodal distribution to get the small hump in the middle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xi'an</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-3017</link>
		<dc:creator>xi'an</dc:creator>
		<pubDate>Fri, 23 Jul 2010 07:10:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-3017</guid>
		<description>Following my previous comment, I looked at the distributions of the collision coordinates, conditional on the location of the endpoints of the segments on the unit square. Depending on those locations, a fit by a Beta(a,a), a Beta(1,a) or a Beta(a,1) is rather accurate. I would thus suggest that the histogram observed above is in fact a mixture of Beta distributions.</description>
		<content:encoded><![CDATA[<p>Following my previous comment, I looked at the distributions of the collision coordinates, conditional on the location of the endpoints of the segments on the unit square. Depending on those locations, a fit by a Beta(a,a), a Beta(1,a) or a Beta(a,1) is rather accurate. I would thus suggest that the histogram observed above is in fact a mixture of Beta distributions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xi'an</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-3011</link>
		<dc:creator>xi'an</dc:creator>
		<pubDate>Thu, 22 Jul 2010 16:34:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-3011</guid>
		<description>Coming very late into the discussion, I confirm the 17/36 result (I did the computation when driving across France the day before yesterday but could not post the outcome). Now the shape of the histogram is suggesting an arcsine distribution, as in the percentage of positive gains along a very long series of head and tail games (Feller, 1970, volume 1). another point already made in the comments...</description>
		<content:encoded><![CDATA[<p>Coming very late into the discussion, I confirm the 17/36 result (I did the computation when driving across France the day before yesterday but could not post the outcome). Now the shape of the histogram is suggesting an arcsine distribution, as in the percentage of positive gains along a very long series of head and tail games (Feller, 1970, volume 1). another point already made in the comments&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Asher</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-3009</link>
		<dc:creator>Matt Asher</dc:creator>
		<pubDate>Thu, 22 Jul 2010 15:24:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-3009</guid>
		<description>Great to see all the effort that went into finding the true solution! So people know I have to approve all comments by new commenters first (to filter spam that isn&#039;t caught by the filter, ugh!). As a result none of the last 3 posters saw each other&#039;s comments before posting.

I&#039;ll post a followup to this blog post very soon.</description>
		<content:encoded><![CDATA[<p>Great to see all the effort that went into finding the true solution! So people know I have to approve all comments by new commenters first (to filter spam that isn&#8217;t caught by the filter, ugh!). As a result none of the last 3 posters saw each other&#8217;s comments before posting.</p>
<p>I&#8217;ll post a followup to this blog post very soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Bedward</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-3002</link>
		<dc:creator>Michael Bedward</dc:creator>
		<pubDate>Thu, 22 Jul 2010 08:46:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-3002</guid>
		<description>Ah - pleased to see that histogram :)  My guess (really just an extremely vague intuition) was that the behaviour of the system would be similar to the distribution time spent on either side of the origin by a 1D random walk. You see this used as a teaching example where there are two players; Alice pays Bob a penny for each walk step above the origin, while Bob pays Alice for each walk step below (with some tie-break convention for a step at 0). For a game with N steps, a player is most likely to either win N times or o times and least likely to win a middling number of times.</description>
		<content:encoded><![CDATA[<p>Ah &#8211; pleased to see that histogram <img src='http://www.statisticsblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   My guess (really just an extremely vague intuition) was that the behaviour of the system would be similar to the distribution time spent on either side of the origin by a 1D random walk. You see this used as a teaching example where there are two players; Alice pays Bob a penny for each walk step above the origin, while Bob pays Alice for each walk step below (with some tie-break convention for a step at 0). For a game with N steps, a player is most likely to either win N times or o times and least likely to win a middling number of times.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Francois Guillem</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-2987</link>
		<dc:creator>Francois Guillem</dc:creator>
		<pubDate>Tue, 20 Jul 2010 18:36:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-2987</guid>
		<description>Actually, the true rate is 17/36, this correspond exactly to 47.22 %. Here is a proof : http://dl.dropbox.com/u/1850029/cannon.pdf</description>
		<content:encoded><![CDATA[<p>Actually, the true rate is 17/36, this correspond exactly to 47.22 %. Here is a proof : <a href="http://dl.dropbox.com/u/1850029/cannon.pdf" rel="nofollow">http://dl.dropbox.com/u/1850029/cannon.pdf</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Craig</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-2982</link>
		<dc:creator>Peter Craig</dc:creator>
		<pubDate>Tue, 20 Jul 2010 12:09:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-2982</guid>
		<description>Answer is 17/36 = 0.4722 recurring (compute by integration of probability conditional on end points of first line, distinguishing where ends of first line on opposite sides (1/3) and on adjacent sides (2/3))

Relevant conditional probabilities are [4+2xy-x-y]/6 for opposite sides (taking x and y as distances of points from opposite corners of square) and [3x+3y-2xy]/6 for adjacent sides (taking x and y as distances from common corner).

Rest left as exercise.</description>
		<content:encoded><![CDATA[<p>Answer is 17/36 = 0.4722 recurring (compute by integration of probability conditional on end points of first line, distinguishing where ends of first line on opposite sides (1/3) and on adjacent sides (2/3))</p>
<p>Relevant conditional probabilities are [4+2xy-x-y]/6 for opposite sides (taking x and y as distances of points from opposite corners of square) and [3x+3y-2xy]/6 for adjacent sides (taking x and y as distances from common corner).</p>
<p>Rest left as exercise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Asher</title>
		<link>http://www.statisticsblog.com/2010/07/r-clash-of-the-cannon-cycles/comment-page-1/#comment-2980</link>
		<dc:creator>Matt Asher</dc:creator>
		<pubDate>Tue, 20 Jul 2010 10:51:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.statisticsblog.com/?p=384#comment-2980</guid>
		<description>Just realized I was off by an order of magnitude in my comment. If the true ratio was .5 then what I observed would be closer to a 60 sigma event!
 
If the true ratio was 3 / (2*pi) = 47.75% that&#039;s much closer to the test results, but would still mean my test deviated by 10 standard deviations from the mean. A good thought to use Buffon&#039;s Needle as a guide though.</description>
		<content:encoded><![CDATA[<p>Just realized I was off by an order of magnitude in my comment. If the true ratio was .5 then what I observed would be closer to a 60 sigma event!</p>
<p>If the true ratio was 3 / (2*pi) = 47.75% that&#8217;s much closer to the test results, but would still mean my test deviated by 10 standard deviations from the mean. A good thought to use Buffon&#8217;s Needle as a guide though.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

