Jump to content

File:Mean-of-the-outcomes-of-rolling-a-fair-coin-n-times.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 472 × 471 pixels, file size: 117 KB)

Summary

Description
English: R code:
library(magrittr)
library(data.table)
library(ggpubr)
library(extrafont)
loadfonts() # for using "Liberation Sans" font

N <- 5000L
n <- 2^(0:11)
d <- 
  expand.grid(repli = 1L:N, n = n) %>% 
  as.data.table %>%
  .[, mean01 := NA_real_]
set.seed(1234)
for(i in 1L:nrow(d)) {
  set(d, i, j = "mean01", value = rbinom(1, size = d$n[i], prob = 0.5) / d$n[i])
}
ggplot(d, aes(x = mean01)) +
  facet_wrap(vars(n), scales = "free", labeller = "label_both", nrow = 4, ncol = 3) +
  stat_density(aes(fill = ordered(n)), show.legend = F, n = 2048, bw = 0.02) +
  theme_pubr(base_size = 10, base_family = "Liberation Sans", border = T) +
  theme(strip.text = element_text(size = 10)) +
  scale_x_continuous("mean of the outcomes of rolling a fair coin n times", limits = c(0, 1)) +
  scale_y_continuous(expand = expansion(c(0, 0.05)), limits = c(0, 20)) +
  x11(width = 5, height = 5)
Date
Source Own work
Author Chen-Pan Liao

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Captions

Probability distribution of the mean of the outcomes of rolling a fair coin n times.

Items portrayed in this file

depicts

22 April 2024

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current04:40, 22 April 2024Thumbnail for version as of 04:40, 22 April 2024472 × 471 (117 KB)Chen-Pan LiaoUploaded own work with UploadWizard

The following page uses this file:

Metadata