To make the basics of distributions and significance testing a little less foreign, a little more familiar
What's the most obvious thing about the figure below, taken from this week's lecture, of the result of 100,000 trials of 40 coin flips?:
And why does it look the way it does?
What is the binominial distribution
See the relationship?
These instructions are for Open Office Calc: using them for Excel requires that you replace ';' with ',' throughout, and follow the spirit, not the letter, of the instructions wrt the Chart insertion wizard
=randbetween(0;1)
in cell A1You now have 20 trials of 10 coin flips, one trial per row
Ctrl+Alt+F9
by mistake, you will want to
use Ctrl+Alt+F7
to undo that!If you press Ctrl+Shift+F9
, all the coins will be flipped anew
=sum(A1:J1)
in cell K1, and use the
series box to extend that down to K20, giving the number of,
shall we say heads, for each trialaverage
function) and standard
deviation (stdev
) over the 20 trials in K21 and
K22 respectivelyCtrl+Shift+F9
to re-run the 'experiment' several
times, to get a feel for the distribution0--10
in cells A44:K44 by
entering 0
in A44 and dragging the series box to
K44 and
=COUNTIF($K1:$K20;A44)
in A45 and dragging the series box to
K45 and
Re-run with Ctrl+Shift+F9
again and check that the frequency
counts and histogram update correctly
=abs(K21-L21)/(sqrt(0.5*(K22^2+L22^2))*sqrt(2/20))
in
L25 -- that's the Student's t-test for comparing two sample sets with equal sizes,
assumed equal variance:
=tdist(L25;19;2)
in L26, to get the
probability that the two samples came from distinct distributionsRe-run several times and see if the difference is ever significant
This would be a lot more fun if you could test a 'doctored' coin
0
in A23, and use
Insert/Names/Define from the main menu to give A23
the name "Bias"=round(rand()+Bias;0)
What we've done is create the possibility of biasing our coin, to make a heads outcome more likely
By shifting to using the rand
function, we get a random
number between 0 and 1, and then round that up or down
If the bias is greater than 0, that should move the mean up by that amount, and make heads consequently more likely
It doesn't take much -- try putting a 0.3
in the Bias, and
watch the histogram shift
What's the new p value?
Re-run, and experiment with different biases, to find how much bias it takes to get a signficantly detectable different distribution. . .