Description Usage Arguments Details Value Note Author(s) References
This function plots the sample mean as the sample size grows to check whether the sample mean approaches to the population mean.
1 2 3 4 5 6 7 8 9 |
FUN |
a function to generate random numbers from a certain distribution:
|
mu |
population mean; passed to |
np |
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 |
pch |
symbols for points; see Details |
col.poly |
the color of the polygon to annotate the range of sample means |
col.mu |
the color of the horizontal line which denotes the population mean |
... |
other arguments passed to |
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.
None (invisible NULL
).
The argument pch
will influence the speed of plotting, and for a
very large sample size (say, 300), it is suggested that this argument be
specified as '.
'.
Yihui Xie
Examples at https://yihui.org/animation/example/lln-ani/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.