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") 

plot


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -