All possible sums from rolling three dice
set.seed(1234)
sort(sample(3:18, size=16, replace=F, prob=c(1/216, 3/216, 6/216, 10/216, 15/216, 21/216, 25/216, 27/216, 27/216, 25/216, 21/216, 15/216, 10/216, 6/216, 3/216, 1/216)))## [1] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
The frequency of sums for rolling three dice 100000 times.
data <- sort(sample(3:18, size=100000, replace=T, prob=c(1/216, 3/216, 6/216, 10/216, 15/216, 21/216, 25/216, 27/216, 27/216, 25/216, 21/216, 15/216, 10/216, 6/216, 3/216, 1/216)))
table(data)## data
## 3 4 5 6 7 8 9 10 11 12 13 14 15
## 474 1415 2779 4685 6885 9616 11689 12520 12485 11454 9708 7108 4566
## 16 17 18
## 2747 1411 458
## data Freq
## 1 3 474
## 2 4 1415
## 3 5 2779
## 4 6 4685
## 5 7 6885
## 6 8 9616
## 7 9 11689
## 8 10 12520
## 9 11 12485
## 10 12 11454
## 11 13 9708
## 12 14 7108
## 13 15 4566
## 14 16 2747
## 15 17 1411
## 16 18 458
Histogram for the sum of three dice
dice1 <- sample(1:6, 100000, T)
dice2 <- sample(1:6, 100000, T)
dice3 <- sample(1:6, 100000, T)
hist(dice1+dice2+dice3)This is an empirical histogram. It is the sum of rolling three dice for 100000 times.