clt {pad} | R Documentation |
Take samples of size n from a vector of data of size N and computes the empirical distribution of the sample mean, illustrating the central limit theorem.
clt(x, n, nsim, plot = TRUE, ncols = 2) ## S3 method for class 'clt': plot(x, ...)
x |
a numeric vector with the data |
n |
an integer defining the sample size |
nsim |
an integer defining number of samples to be taken |
plot |
logical. If TRUE histograms are produced in the graphical device. |
ncols |
numerical. The number of columns in the graphical
device. Only valid if plot = TRUE . |
... |
unused. |
Returns a list which is an object of the class
clt
. The list components are:
data |
a vector with the data passed to the function |
sizeN |
a list with vectors of averages (xbar ) and standard deviations (sd ) of each sample |
For each sample size N provided there will be one component as
the latter.
mbox{}
The function hist.clt
plots histograms of the sample means
on the current graphics device.
Peter J. Diggle p.diggle@lancaster.ac.uk
Paulo Justiniano Ribeiro Jr. p.ribeiro@lancaster.ac.uk.
clt(rexp(1000), c(2,4,8,16,32), 1000) # par.now <- par(no.readonly=TRUE) par(mfrow=c(3,2)) data.clt <- clt(exp(rnorm(2000)), c(2,4,8,16,32), 1000, plot=FALSE) plot(data.clt) par(par.now) # # For an interactive input type: ## Not run: clt() ## End(Not run)