I already explained the problem with http://rpubs.com/jjc/16415 any why it fails the bet.
In the "new" one, change this line
b "left arrow" c(cos(beta), sin(beta)) ## Measurement vector 'b'
to this one
b "left arrow" c(0.5, 0.3) ## Measurement vector 'b'
and explain why and how the correlation curve changes. If you genuinely understand this, then you will understand how and why the bet test fails.
For the benefit of whoever wrote http://rpubs.com/jjc/16415 here is the explanation:
b "left arrow" c(0.5, 0.3) means that B=(0,5, 0.3, 0.81240384) The "e" and "a" variable have 2 components meaning that their 3D representation is of the form:
e = (e_x, e_y, 0)
a = (a_x, a_y, 0)
The inner product in:
ca "left arrow" colSums(e * a) ## Inner products of cols of 'e' with 'a'
cb "left arrow" colSums(e * b) ## Inner products of cols of 'e' with 'b'
means this:
e * a = e_x a_x e_y a_y a_z e_z = e_x a_x e_y a_y (because e_z = 0)
e * b = e_x b_x e_y b_y a_z b_z = e_x b_x e_y b_y (because e_z = 0)
and the local hidden variable "e" in the file provided to Richard is always a vector orthogonal to (0,0,1). As long as "b" is of the form (b_x, b_y, 0) WITH b_x^2 b_y^2 = 1 (meaning it has no z-component) you will recover the approximate -cosine curve. However, when you pick some other b with a non-zero z-component (which is not used directly in http://rpubs.com/jjc/16415) you get a bad correlation curve. Just try it in R using this line:
b "left arrow" c(0.5, 0.3) ## Measurement vector 'b'
The bet is not settled on obtaining an approximate -cosine curve, but on computing correlations the stand way. And this method is blind to the spherical symmetry or lack of it for the vectors "e".
In general people propose spherically symmetric hidden variables and when they do so you only need to keep one measurement direction fixed (like Bob's measurement direction b) and change the other measurement direction (Alice's direction "a"). Under spherical symmetry changing the orientation of B does not produce anything different. However in this case "e" does not respect spherical symmetry (because it IS ALWAYS ORTHOGONAL TO (0,0,1)) and fixing B to (cos(beta), sin(beta), 0) does obtain the -cosine like correlation. But this is ONLY ONE SLICE in the A-B space. Change B to something else which is not orthogonal to (0,0,1) and you mess up the correlation. To do that you have to change b in the script to: (b_x, b_y) WITH b_x^2 b_y^2 < 1 which means that there is a "hidden" b_z such that b_x^2 b_y^2 b_z^2 = 1
Now you may object that (b_x, b_y) WITH b_x^2 b_y^2 < 1 is not your model and you do recover -cosine like correlation with "c(cos(beta), sin(beta))" but I am not changing the b to c(0.5, 0.3) to win the bet, but to provide an explanation why Richard correlation came out agreeing with Bell's prediction EVEN WITH THE FILE PRODUCED BY "c(cos(beta), sin(beta))". This explanation is not to adjudicate the bet, but to explain the apparent contradiction between the -cosine like curve and Richard correlation. In other words, it is just a pedagogical explanation, take it or leave it.
I still stand by my prediction: April 2016 this controversy will no be settled.