File:LawOfLargeNumbersCauchy.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 720 × 405 pixels, file size: 207 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
English: Sample means of indepedent random variables from the standard Cauchy distribution. This figure is intended to illustrate a hypothesis "a distribution has a finite mean" in the law of large numbers is necessary.
Date
Source Own work
Author ARAKI Satoru
library(ggplot2)
library(latex2exp)

set.seed(2018)

# Number of samples:
N <- 3000
# Three series of indepedent N samples from the standard Cauchy distribution:
x1 <- rcauchy(N); x2 <- rcauchy(N); x3 <- rcauchy(N)
# Sample means:
m <- function(x) {
  return(sapply(1:N, function(n) mean(x[1:n])))
}
m1 <- m(x1); m2 <- m(x2); m3 <- m(x3)

d1 <- data.frame(x=1:N, y=m1, w=sapply(1:N, function(n) "1"))
d2 <- data.frame(x=1:N, y=m2, w=sapply(1:N, function(n) "2"))
d3 <- data.frame(x=1:N, y=m3, w=sapply(1:N, function(n) "3"))
data <- rbind(d1, d2, d3)

fig <- ggplot(data) +   
  geom_hline(yintercept=0, alpha=.5) +
  geom_line(aes(x=x, y=y, color=w)) + 
  labs(x=TeX("$n$"), y=TeX("$(x_1 + \\cdots + x_n)/n$")) +
  guides(color=FALSE)

svg(filename="LawOfLargeNumbersCauchy.svg", width=16/2, height=9/2)
plot(fig)
dev.off()

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

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

Date/TimeThumbnailDimensionsUserComment
current13:59, 27 July 2018Thumbnail for version as of 13:59, 27 July 2018720 × 405 (207 KB)ARAKI Satoru (talk | contribs)simplify the generating code
12:30, 27 July 2018Thumbnail for version as of 12:30, 27 July 2018720 × 405 (207 KB)ARAKI Satoru (talk | contribs)changed y-label
12:00, 27 July 2018Thumbnail for version as of 12:00, 27 July 2018720 × 405 (209 KB)ARAKI Satoru (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata