This function plots the sample mean as the sample size grows to check whether the sample mean approaches to the population mean.
lln.ani(
FUN = rnorm,
mu = 0,
np = 30,
pch = 20,
col.poly = "bisque",
col.mu = "gray",
...
)
a function to generate random numbers from a certain distribution:
function(n, mu)
population mean; passed to FUN
times for sampling from a distribution (not the sample size!); to examine the behaviour of the sample mean, we need more times of sampling to get a series of mean values
symbols for points; see Details
the color of the polygon to annotate the range of sample means
the color of the horizontal line which denotes the population mean
other arguments passed to points
None (invisible NULL
).
np
points are plotted to denote the distribution of the sample mean;
we will observe that the range of the sample mean just becomes smaller and
smaller as the sample size increases and ultimately there will be an obvious
trend that the sample mean converges to the population mean mu
.
The parameter nmax
in ani.options
means the maximum
sample size.
Examples at https://yihui.org/animation/example/lln-ani/