Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
law of large numbers
sim <- vector() heads <-vector() results <- vector() for(i in 1:200) { sim[[i]] <- sample(c("h","t"), 1, replace = TRUE) heads[[i]] = length(sim[sim=="h"]) results[[i]] <- heads[[i]]/i } #the plot n = c(1:100) plot(n, results[1:100], ylim = c(0,1), pch=16,cex=0.75, col = "skyblue", main = "Proportion of Heads", ylab="Proportion", xlab="Number of Coin Flips", yaxt="n") lines(n, results[1:100], type = "l", col = "skyblue", lwd=4) abline(h=0.5, col = "darkblue") axis(2, at=seq(0,1,0.25), labels=seq(0,1,0.25))
run
|
edit
|
history
|
help
0
ggplot Sample
User defined functions
Graficos
R Basic
1
For loops Example
BTBsung
EulerEx2
Зиккурат
14-09-2020QRajustelinear