## When Buffon meets Bertrand

Posted in R, Statistics, Travel with tags , , , , , on April 7, 2011 by xi'an

When Peter Diggle gave his “short history” of spatial statistics this morning (I typed this in the taxi from Charles de Gaulle airport, after waiting one hour for my bag!), he started with a nice slide about Buffon’s needle (and Buffon’s portrait), since Julian Besag was often prone to give this problem as a final exam to Durham students (one of whom is responsible for the candidate’s formula). This started me thinking about how this was open to a Bertrand’s paradox of its own. Indeed, randomness for the needle throw can be represented in many ways:

• needle centre uniformly distributed over the room (or the perpendicular to the boards) with a random orientation (with a provision to have the needle fit);
• needle endpoint uniformly distributed over the room (again a uniform over the perpendicular is enough) with a random orientation (again with a constraint);
• random orientation from one corner of the room and a uniform location of the centre on the resulting line (with constraints on both ends for the needle to fit);
• random orientation from one corner of the room and a uniform location of one endpoint on the resulting line, plus a Bernoulli generation to decide on the orientation (with constraints on both ends for the needle to fit);
• &tc.

I did not have time to implement those different generation mechanisms in R, but have little doubt they should lead to different probabilities of intersection between the needle and one of the board separations. I actually found a web-page at the University of Alabama Huntsville addressing this problem through exercises (plus 20,000 related entries! Including von MisesProbability, Statistics and Truth itself. A book I should read one of those days, following Andrew.). Note that each version corresponds to a physical mechanism. Thus that there is no way to distinguish between them. Had I time, I would also like to consider the limiting case when the room gets infinite as, presumably, some of those proposals would end up being identical.

## Bertand’s paradox [R details]

Posted in Books, R, Statistics with tags , , , , , , , on March 20, 2011 by xi'an

Some may have had reservations about the “randomness” of the straws I plotted to illustrate Bertrand’s paradox. As they were all going North-West/South-East. I had actually made an inversion between cbind and rbind in the R code, which explained for this non-random orientation. Above is the corrected version, which sounds “more random” indeed. (And using wheat as the proper, if weak, colour!) The outcome of a probability of 1/2 has not changed, of course. Here is the R code as well:


lacorde=rep(0,10^3)
plot(0,0,type="n",xlim=c(-2,2),ylim=c(-2,2))

for (t in 1:10^3){

#distance from O to chord
dchord=10

while (dchord>1){
#Generate "random" straw in large box till it crosses unit circle

a=runif(2,-10,10)
b=runif(2,-10,10)

#endpoints outside the circle
if ((sum(a^2)>1)&&(sum(b^2)>1)){

theta=abs(acos(t(b-a)%*%a/sqrt(sum((b-a)^2)*sum(a^2))))
theta=theta%%pi
thetb=abs(acos(t(a-b)%*%b/sqrt(sum((b-a)^2)*sum(b^2))))
thetb=thetb%%pi

#chord inside
if (max(abs(theta),abs(thetb))<pi/2)
dchord=abs(sin(theta))*sqrt(sum(a^2))
}
}

lacorde[t]=2*sqrt(1-dchord)
if (runif(1)<.1) lines(rbind(a,b),col="wheat")
}

lecercle=cbind(sin(seq(0,2*pi,le=100)),cos(seq(0,2*pi,le=100)))
lines(lecercle,col="sienna")



As a more relevant final remark, I came to the conclusion (this morning while running) that the probability of this event can be anything between 0 and 1, rather than the three traditional 1/4, 1/3 and 1/2. Indeed, for any distribution of the “random” straws, hence for any distribution on the chord length L, a random draw can be expressed as L=F⁻¹(U), where U is uniform. Therefore, this draw is also an acceptable transform of a uniform draw, just like Bertrand’s three solutions.

## Bertrand’s paradox

Posted in Books, Statistics, Travel, University life with tags , , , on March 17, 2011 by xi'an

While progressing through Jaynes’ Probability Theory for my classes next week, I reached the end of Chapter 12 where he proposed a “resolution” of Bertrand’s paradox. Jaynes gives the following description of the paradox:

Bertrand’s problem was stated originally in terms of drawing a straight line `at random’ intersecting a circle (…) we do no violence to the problem if we suppose we are tossing straws onto the circle (…) What is the probability that the chord thus defined [by a random straw] is longer than the side of the inscribed equilateral triangle?

My understanding of the paradox is that it provides a perfect illustration of the lack of meaning of “random” and of the need for a proper definition of the σ-algebra leading to a probabilised space. Different σ-algebras lead to different probabilities, e.g., 1/4, 1/3, 1/2… However, Jaynes considers there is a “correct” answer and endeavours to construct an invariant distribution on the location of the centre of the chord, achieving Borel’s distribution

$p(x) = \frac{x}{\sqrt{1-x^2}}$

on the chord proportion L/2R. When illustrating this approach, I tried to bring an empirical vision and generated “random” straws by picking both ends at random on the (-10,10)^2 square. Here is a subsample of 10³ such straws interesting with the unit circle. The empirical distribution of the chord proportion is actually quite in agreement with Borel’s distribution, with a probability of being longer than the side of 1/2, as shown below but this does not validate Jaynes’ argument, simply illustrates that I picked the same σ-algebra as his. (Every σ-algebra considered by Bertrand could as well have been used for the simulation.)