> barplot(dbinom(0:12,12,1/6),names.arg=c(0:12),space=0,xlab="Sum of Dice",ylab="Probability",main="Prob. Distribution of the Sum under H0",col="papayawhip") > data.frame(list(Sum = 0:12, Prob = round(dbinom(0:12,12,1/6),10))) Sum Prob 1 0 0.1121566548 2 1 0.2691759715 3 2 0.2960935686 4 3 0.1973957124 5 4 0.0888280706 6 5 0.0284249826 7 6 0.0066324959 8 7 0.0011369993 9 8 0.0001421249 10 9 0.0000126333 11 10 0.0000007580 12 11 0.0000000276 13 12 0.0000000005 > > > R1 = c(8:12) > sum(dbinom(R1,12,1/6)) [1] 0.0001555443 > R2 = c(5:12) > sum(dbinom(R2,12,1/6)) [1] 0.03635002 > > R3 = c(4:12) > sum(dbinom(R3,12,1/6)) [1] 0.1251781 > R4 = c(4,6) > sum(dbinom(R4,12,1/6)) [1] 0.09546057 > sum(dbinom(c(7:12),12,1/6)) [1] 0.001292544 > for(i in 1:13){pvals[i] = binom.test(i-1,12,p=1/6,alternative="two.sided")$p.value} > pvals [[1]] [1] 0.2373347 [[2]] [1] 0.7039064 [[3]] [1] 1 [[4]] [1] 0.4347305 [[5]] [1] 0.1251781 [[6]] [1] 0.03635002 [[7]] [1] 0.00792504 [[8]] [1] 0.001292544 [[9]] [1] 0.0001555443 [[10]] [1] 1.341935e-05 [[11]] [1] 7.860225e-07 [[12]] [1] 2.802301e-08 [[13]] [1] 4.593937e-10 >