clt {gsse401}R Documentation

GSSE 401 - Illustrates the Central Limit Theorem

Description

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.

Usage

clt(x, n, nsim, plot = TRUE, ncols = 2)

plot(x)

Arguments

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.

Value

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.

Author(s)

Peter J. Diggle p.diggle@lancaster.ac.uk
Paulo Justiniano Ribeiro Jr. p.ribeiro@lancaster.ac.uk.

Examples

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)

[Package gsse401 version 0.0-8 Index]