[Distr-commits] r1361 - in branches/distr-2.9/pkg/distrTeach: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Nov 23 22:25:12 CET 2021
Author: ruckdeschel
Date: 2021-11-23 22:25:12 +0100 (Tue, 23 Nov 2021)
New Revision: 1361
Modified:
branches/distr-2.9/pkg/distrTeach/R/illustCLT.R
branches/distr-2.9/pkg/distrTeach/inst/NEWS
branches/distr-2.9/pkg/distrTeach/man/plotCLT.Rd
Log:
devel branch 2.9 : distrTeach:
+ new S4 method for plotting summand distributions of class "UnivariateDistribution"
(i.e., covering, e.g., mixtures of discrete and abs. cont distributions) -> then only
the cdfs for different numbers of summands are plotted
Modified: branches/distr-2.9/pkg/distrTeach/R/illustCLT.R
===================================================================
--- branches/distr-2.9/pkg/distrTeach/R/illustCLT.R 2021-10-06 08:20:45 UTC (rev 1360)
+++ branches/distr-2.9/pkg/distrTeach/R/illustCLT.R 2021-11-23 21:25:12 UTC (rev 1361)
@@ -121,4 +121,28 @@
par(mfrow = c(1,1), mar=oldmar)
})
+setMethod("plotCLT","UnivariateDistribution", function(Tn,k, summands = "") {
+ N <- Norm()
+ x <- seq(-5,5,0.01)
+ oldmar <- par("mar",no.readonly = TRUE)
+ par(mfrow = c(1,1), mar = c(5.1,4.1,4.,2.1))
+ pn <- p(Tn)(x)
+ pN <- p(N)(x)
+ plot(x, pn, ylim = c(0, 1), type = "l",
+ ylab = gettext("cdfs"), main="",
+ lwd = 4)
+ title(paste("Sample size", k),line=0.6)
+ lines(x, pN, col = "orange", lwd = 2)
+ kd <- round(max(abs(pn-pN)),4)
+ text(1, 0.2, gettextf("Kolmogoroff-\nDistance:\n%1.4f",kd),
+ adj = 0, cex = 0.8)
+ legend("topleft", # x = -4.5, y = 1.,
+ legend = c(expression(italic(L)(frac(S[n]-E(S[n]),
+ sd(S[n])))), expression(italic(N)(0,1))),
+ cex = .8, bty = "n", col = c("black", "orange"),
+ lwd = c(4,2))
+ par(mfrow = c(1,1), mar=oldmar)
+ })
+
+
Modified: branches/distr-2.9/pkg/distrTeach/inst/NEWS
===================================================================
--- branches/distr-2.9/pkg/distrTeach/inst/NEWS 2021-10-06 08:20:45 UTC (rev 1360)
+++ branches/distr-2.9/pkg/distrTeach/inst/NEWS 2021-11-23 21:25:12 UTC (rev 1361)
@@ -8,6 +8,17 @@
information)
##############
+v 2.9
+##############
+
+user-visible CHANGES:
+
++ new S4 method for plotting summand distributions of class
+ "UnivariateDistribution" (i.e., covering, e.g., mixtures
+ of discrete and abs. cont distributions) -> then only
+ the cdfs for different numbers of summands are plotted
+
+##############
v 2.8
##############
Modified: branches/distr-2.9/pkg/distrTeach/man/plotCLT.Rd
===================================================================
--- branches/distr-2.9/pkg/distrTeach/man/plotCLT.Rd 2021-10-06 08:20:45 UTC (rev 1360)
+++ branches/distr-2.9/pkg/distrTeach/man/plotCLT.Rd 2021-11-23 21:25:12 UTC (rev 1361)
@@ -3,6 +3,7 @@
\alias{plotCLT-methods}
\alias{plotCLT,AbscontDistribution-method}
\alias{plotCLT,DiscreteDistribution-method}
+\alias{plotCLT,UnivariateDistribution-method}
\title{Generic Plot Function for Illustrating the CLT}
\description{Generic 'plot' function for generating the plots of 'illustrateCLT'.}
@@ -10,6 +11,7 @@
\usage{plotCLT(Tn, ...)
\S4method{plotCLT}{AbscontDistribution}(Tn, k, summands="")
\S4method{plotCLT}{DiscreteDistribution}(Tn, k, summands="")
+\S4method{plotCLT}{UnivariateDistribution}(Tn, k, summands="")
}
\arguments{
\item{Tn}{object of class \code{"AbscontDistribution"} or class
More information about the Distr-commits
mailing list