illustrateLLN

0th

Percentile

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 in par
cex.legend
magnification w.r.t. the current setting of cex to be used for the legend as in par
...
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"
{class of argument x} "%P"{parameters of x in form of a comma-separated list of 's coerced to character} "%Q"{parameters of x in form of a comma-separated list of 's coerced to character and in parenthesis --- unless empty; then ""} "%N"{parameters of x in form of a comma-separated list = coerced to character} "%A"{deparsed argument x} "%D"{time/date-string when the plot was generated} "%X"{the expression $\bar X_n=\sum_{i=1}^n X_i/n$}

Value

  • void

code

lty

concept

  • illustration
  • teaching
  • LLN

Aliases
  • illustrateLLN
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)
Documentation reproduced from package distrEx, version 1.9, License: GPL (version 2 or later)

Community examples

Looks like there are no examples yet.