| Version: | 2.9.2 |
| Date: | 2025-01-11 |
| Title: | Extensions of Package 'distr' for Teaching Stochastics/Statistics in Secondary School |
| Description: | Provides flexible examples of LLN and CLT for teaching purposes in secondary school. |
| Depends: | R(≥ 3.4), methods, distr(≥ 2.2), distrEx(≥ 2.2) |
| Suggests: | tcltk |
| Imports: | startupmsg(≥ 1.0.0), grDevices, graphics, stats |
| ByteCompile: | yes |
| License: | LGPL-3 |
| Encoding: | UTF-8 |
| URL: | http://distr.r-forge.r-project.org/ |
| Packaged: | 2025-01-11 22:07:16 UTC; ruckdesc |
| LastChangedDate: | {$LastChangedDate: 2024-01-30 20:10:15 +0100 (Di, 30 Jan 2024) $} |
| LastChangedRevision: | {$LastChangedRevision: 1430 $} |
| VCS/SVNRevision: | 1493 |
| NeedsCompilation: | no |
| Author: | Eleonora Feist [ctb] (contributed as student in the initial phase --2008), Matthias Kohl [aut, cph], Peter Ruckdeschel [cre, cph], Anja Hueller [ctb] (contributed as student in the initial phase --2008) |
| Maintainer: | Peter Ruckdeschel <peter.ruckdeschel@uni-oldenburg.de> |
| Repository: | CRAN |
| Date/Publication: | 2025-01-13 19:10:09 UTC |
distrTeach – Teaching Extensions of Package distr
Description
distrTeach provides some illustrations based on package distr for teaching Stochastics / Statistics in secondary school; so far the following has been implemented
-
illustrateLLT: function for the generation of LLN - visualizations -
illustrateCLT: function for the generation of CLT - visualizations -
plotCLT: Generic function for the plotting of CLT-approximations
as well as a Tcl/Tk based demo forillustrateCLT
Details
| Package: | distrTeach |
| Version: | 2.9.2 |
| Date: | 2025-01-11 |
| Depends: | R(>= 3.4), methods, distr(>= 2.2), distrEx(>= 2.2) |
| Suggests: | tcltk |
| Imports: | startupmsg(>= 1.0.0), grDevices, graphics, stats |
| LazyLoad: | yes |
| License: | LGPL-3 |
| URL: | http://distr.r-forge.r-project.org/ |
| VCS/SVNRevision: | 1493 |
Classes
Teaching Classes
Methods
illustration: illustrateLLT function for the generation of LLN - visualizations illustrateCLT function for the generation of CLT - visualizations plotCLT Generic function for the plotting of CLT-approximations
Demos
Demos are available — see demo(package="distrTeach").
Start-up-Banner
You may suppress the start-up banner/message completely by setting
options("StartupBanner"="off") somewhere before loading this package by
library or require in your R-code / R-session.
If option "StartupBanner" is not defined (default) or setting
options("StartupBanner"=NULL) or
options("StartupBanner"="complete") the complete start-up banner is
displayed.
For any other value of option "StartupBanner" (i.e., not in
c(NULL,"off","complete")) only the version information is displayed.
The same can be achieved by wrapping the library or require call
into either suppressStartupMessages() or
onlytypeStartupMessages(.,atypes="version").
As for general packageStartupMessage's, you may also suppress all
the start-up banner by wrapping the library or require
call into suppressPackageStartupMessages() from
startupmsg-version 0.5 on.
Package versions
Note: The first two numbers of package versions do not necessarily reflect package-individual development, but rather are chosen for the distrXXX family as a whole in order to ease updating "depends" information.
Author(s)
Matthias Kohl Matthias.Kohl@stamats.de and
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de,
Eleonara Feist eleonoragerber@gmx.de, and,
Anja Hueller
Maintainer: Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de
References
P. Ruckdeschel, M. Kohl, T. Stabla, F. Camphausen (2006): S4 Classes for Distributions, R News, 6(2), 2-6. https://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf a vignette for packages distr, distrSim, distrTEst,
and distrTeach is included into the mere documentation package distrDoc
and may be called by require("distrDoc");vignette("distr")
a homepage to this package is available under
https://distr.r-forge.r-project.org/ and the pages ...
M. Kohl (2005): Numerical Contributions to the Asymptotic
Theory of Robustness. PhD Thesis. Bayreuth. Available as
https://www.stamats.de/wp-content/uploads/2018/04/ThesisMKohl.pdf
See Also
Functions for Illustrating the CLT
Description
Functions for generating a sequence of plots of
the density and cdf of the consecutive standardized and centered sums of iid
r.v. distributed according to a prescribed discrete or absolutely continuous
distribution compared to the standard normal — uses the generic function
plotCLT.
Usage
illustrateCLT(Distr, len, sleep = 0)
illustrateCLT.tcl(Distr, k, Distrname)
Arguments
Distr |
object of class |
len |
integer: up to which number of summands plots are generated |
k |
integer: number of summands for which a plot is to be generated |
Distrname |
character: name of the summand distribution to be used as title in the plot |
sleep |
numeric: pause in seconds between subsequent plots |
Details
illustrateCLT generates a sequence of plots, while
illustrateCLT.tcl may be used with Tcl/Tk-widgets as in demo
illustCLT_tcl.R.
Value
void
Author(s)
Matthias Kohl Matthias.Kohl@stamats.de
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de
References
Kohl, M., Ruckdeschel, P., (2014): General purpose convolution algorithm for distributions in S4-Classes by means of FFT. J. Statist. Softw. 59(4): 1-25.
See Also
Examples
distroptions("DefaultNrFFTGridPointsExponent" = 13)
illustrateCLT(Distr = Unif(), len = 10)
distroptions("DefaultNrFFTGridPointsExponent" = 12)
illustrateCLT(Distr = Pois(lambda = 2), len = 10)
distroptions("DefaultNrFFTGridPointsExponent" = 13)
illustrateCLT(Distr = Pois(lambda = 2)+Unif(), len = 10)
illustrateCLT.tcl(Distr = Unif(), k = 4, "Unif()")
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 |
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 |
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 |
lty.Eline |
integer code (see |
col.Conf |
character or integer code; color for confidence bands |
lwd.Conf |
integer code (see |
lty.Conf |
integer code (see |
cex.Cover |
magnification w.r.t. the current setting of |
cex.legend |
magnification w.r.t. the current setting of |
... |
further arguments to be passed to |
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
xin form of a comma-separated list of <value>'s coerced to character"%Q"parameters of
xin form of a comma-separated list of <value>'s coerced to character and in parenthesis — unless empty; then """%N"parameters of
xin 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)
Generic Plot Function for Illustrating the CLT
Description
Generic 'plot' function for generating the plots of 'illustrateCLT'.
Usage
plotCLT(Tn, ...)
## S4 method for signature 'AbscontDistribution'
plotCLT(Tn, k, summands="")
## S4 method for signature 'DiscreteDistribution'
plotCLT(Tn, k, summands="")
## S4 method for signature 'UnivariateDistribution'
plotCLT(Tn, k, summands="")
Arguments
Tn |
object of class |
k |
integer: number off summands to be plotted as graphics title |
summands |
character: name of the summands |
... |
addtional arguments for methods not yet implemented |
Value
void
Author(s)
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de
Matthias Kohl Matthias.Kohl@stamats.de
See Also
Examples
illustrateCLT(Distr = Unif(), len = 20)