boot_sdm {CAISEr}R Documentation

Bootstrap the sampling distribution of the mean

Description

Bootstraps the sampling distribution of the means for a given vector of observations

Usage

boot_sdm(x, boot.R = 999, ncpus = 1, seed = NULL)

Arguments

x

vector of observations

boot.R

number of bootstrap resamples

ncpus

number of cores to use

seed

seed for the PRNG

Value

vector of bootstrap estimates of the sample mean

References

Author(s)

Felipe Campelo (fcampelo@ufmg.br, f.campelo@aston.ac.uk)

Examples

x <- rnorm(15, mean = 4, sd = 1)
my.sdm <- boot_sdm(x)
hist(my.sdm, breaks = 30)
qqnorm(my.sdm, pch = 20)

x <- runif(12)
my.sdm <- boot_sdm(x)
qqnorm(my.sdm, pch = 20)

# Convergence of the SDM to a Normal distribution as sample size is increased
X <- rchisq(1000, df = 3)
x1 <- rchisq(10, df = 3)
x2 <- rchisq(20, df = 3)
x3 <- rchisq(40, df = 3)
par(mfrow = c(2, 2))
plot(density(X), main = "Estimated pop distribution");
hist(boot_sdm(x1), breaks = 25, main = "SDM, n = 10")
hist(boot_sdm(x2), breaks = 25, main = "SDM, n = 20")
hist(boot_sdm(x3), breaks = 25, main = "SDM, n = 40")
par(mfrow = c(1, 1))

[Package CAISEr version 1.0.16 Index]