Learn R Programming

resample (version 0.2)

plot.resample: Methods for common generic functions for resample objects

Description

Methods for common generic functions. The methods for plot, hist, qqnorm, and quantile operate primarily on the replicates.

Usage

## S3 method for class 'resample':
print(x, ...)
## S3 method for class 'resample':
plot(x, ..., resampleColumns = 1:x$p, xlim = NULL, xlab = NULL, main = "")
## S3 method for class 'resample':
hist(x, ..., resampleColumns = 1:x$p, xlim = NULL, xlab = NULL, main = "")
## S3 method for class 'resample':
qqnorm(y, ..., resampleColumns = 1:y$p, ylab = NULL)
## S3 method for class 'resample':
quantile(x, ..., type = 6)

Arguments

x,y
a "resample" object, usually produced by one of bootstrap, bootstrap2, permutatio
...
additional arguments passed to the corresponding generic function.
resampleColumns
integer subscripts, or names of statistics. When a statistic is a vector, resampleColumns may be used to select which resampling distributions to plot.
xlim
limits for the x axis.
xlab, ylab
x and y axis labels.
main
main title
type
the type argument for quantile. The value used here gives somewhat wider quantiles than the usual default, which are appropriate for resampling.

Value

  • For quantile.resample, a matrix with one column for each statistic.

    The other functions are not called for their return values.

Details

hist.resample and plot.resample are identical; they display a histogram overlaid with a density plot, with the observed value of the statistic indicated.

See Also

bootstrap, bootstrap2, permutationTest, permutationTest2.

Examples

Run this code
mydata <- data.frame(a = runif(40), b = rnorm(40))
boot1 <- bootstrap(mydata, colMeans)
boot1
par(mfrow = c(2,1))
plot(boot1)
hist(boot1) # same as plot
qqnorm(boot1)
par(mfrow = c(1,1))
quantile(boot1, probs = c(.25, .75))

Run the code above in your browser using DataLab