illustrateLLN
From distrEx v1.9
by Matthias Kohl
Functions for Illustrating the LLN
Functions for generating a sequence of plots of randomly generated replicates of $\bar X_n= \frac{1}{n} \sum_{i=1}^n X_i$ for sums of iid r.v. distributed according to a prescribed discrete or absolutely continuous distribution. A line for the expectation and CLT based (pointwise) 95%-confidence bands are also plotted and the empirical coverage of this band by the replicated plotted so far is indicated.
- Keywords
- methods, distribution, dynamic
Usage
illustrateLLN(Distr = Norm(),n = c(1,3,5,10,25,50,100,500,1000,10000),
m = 50, step = 1, sleep = 0, withConf = TRUE,
withCover = (length(n)
Arguments
- Distr
- object of class
"UnivariateDistribution"
: distribution of the summands - n
- vector of integers: sample sizes to be considered
- m
- integer: (total) number of replicates to be plotted subsequently
- step
- integer: number of replicates to be drawn at once
- sleep
- numeric: pause in seconds between subsequent plots
- withEline
- logical: shall a line for the limiting expectation
(in case of class
Cauchy
instead: median) be drawn? - withConf
- logical: shall (CLT-based) confidence bands be plotted?
- withCover
- logical: shall empirical coverage of (CLT-based) confidence bands be printed?
- withLegend
- logical: shall a legend be included?
- CLTorCheb
- character: type of confidence interval ---"CLT" or "Chebyshev"; partial matching is used; if this fails "CLT" is used.
- coverage
- numerical: nominal coverage of the confidence bands ---to be in (0,1)
- col.Eline
- character or integer code; color for confidence bands
- lwd.Eline
- integer code (see
par
); line width of the confidence bands - lty.Eline
- integer code (see
par
); line type of the confidence bands - col.Conf
- character or integer code; color for confidence bands
- lwd.Conf
- integer code (see
par
); line width of the confidence bands - lty.Conf
- integer code (see
par
); line type of the confidence bands - cex.Cover
- magnification w.r.t. the current setting of
cex
to be used for empirical coverages; as inpar
- cex.legend
- magnification w.r.t. the current setting of
cex
to be used for the legend as inpar
- ...
- further arguments to be passed to
matplot
,matlines
,abline
Details
illustrateLLN
generates a sequence of plots.
Any parameters of plot.default
may be passed on to this particular
plot
method.
There are default main
titles as well as xlab
and ylab
annotations.
In all title arguments, the following patterns are substituted:
"%C"
x
}
"%P"
x
in form of a comma-separated list of
"%Q"
x
in form of a comma-separated list of
"%N"
x
in form of a comma-separated list
"%A"
x
}
"%D"
"%X"
Value
- void
code
lty
concept
- illustration
- teaching
- LLN
Examples
illustrateLLN(Distr = Unif())
illustrateLLN(Distr = Pois(lambda = 2))
illustrateLLN(Distr = Pois(lambda = 2)+Unif())
illustrateLLN(Td(3), m = 50, col.Eline = "green", lwd = 2, cex = 0.6, main =
"My LLN %C%Q", sub = "generated %D")
illustrateLLN(Td(3), m = 50, CLTorCheb = "Chebyshev")
illustrateLLN(Td(3), m = 50, CLTorCheb = "Chebyshev", coverage = 0.75)
Community examples
Looks like there are no examples yet.