illustrateLLN {distrTeach}R Documentation

Functions for Illustrating the LLN

Description

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.

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)<=12), withEline = TRUE, withLegend = TRUE,
            CLTorCheb = "CLT",  coverage = 0.95, ...,  col.Eline = "blue", 
            lwd.Eline = par("lwd"), lty.Eline = par("lty"), col.Conf = "red", 
            lwd.Conf = par("lwd"), lty.Conf = 2, cex.Cover = 0.7, 
            cex.legend = 0.8)

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 <value>'s coerced to character

"%Q"

parameters of x in form of a comma-separated list of <value>'s coerced to character and in parenthesis — unless empty; then ""

"%N"

parameters of x in form of a comma-separated list <name> = <value> 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

If not explicitly set, col.Eline, col.Conf are set to col if this arg is given and else to their default values as given above. Similarly for cex, lwd and lty.

Value

void

Author(s)

Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de

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) 

[Package distrTeach version 2.9.1 Index]