Is there a simple simulation of the law of large numbers in r? -
i understand law of large numbers, can't find simple example simulating in r. can give me example of law in r?
this question closed, perhaps suffice:
die <- 1:6 roll <- function(n) { mean(sample(die, size = n, replace = true)) } plot(sapply(1:1000, roll), type = "l", xlab = "# of dice", ylab = "average") abline(h = 3.5, col = "red")
Comments
Post a Comment