Package 'bstrap'

Title: Obtain and plot bootstrap sampling distributions of the sample mean
Description: Many common tests assume sufficient normality of the data distribution, with the received wisdom that if the sample size is "large", the normality doesn't matter so much (because of the Central Limit Theorem). It is difficult to judge the normality is good enough, or whether the sample size is big enough. A better way to investigate is to obtain a bootstrap sampling distribution of the sample mean (by taking repeated bootstrap samples), and to assess that distribution for normality. If it is, the normal-theory test will work; if not, not.
Authors: Ken Butler [aut, cre]
Maintainer: Ken Butler <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1
Built: 2026-05-24 07:33:53 UTC
Source: https://worktree.ca/nxskok/bstrap

Help Index


Home prices data

Description

Selling prices of 3-bedroom and 4-bedroom homes in West Lafayette, Indiana

Usage

home_prices

Format

A dataframe with 37 rows and 2 columns:

price

Selling price in US $

bdrms

Number of bedrooms (3 or 4)

Source

http://ritsokiguess.site/datafiles/homes.csv


Generate bootstrap samples and calculate sample means

Description

Generate bootstrap samples and calculate sample means

Usage

make_dist(x, nsim = 100)

Arguments

x

vector of data to sample from

nsim

number of bootstrap samples

Value

dataframe containing column x_mean

Examples

make_dist(1:5, 20)
make_dist(mtcars$disp, 30)

Obtain bootstrap sampling distributions for several samples

Description

Obtain bootstrap sampling distributions for several samples

Usage

make_several(x, g = "a", nsim = 10000)

Arguments

x

vector of observations

g

vector of group membership of each observation

nsim

number of bootstrap samples to draw for each group

Value

dataframe containing columns x_mean containing bootstrap sample and group, group for which that bootstrap sample was drawn

Examples

with(mtcars, make_several(disp, cyl, 5))

Obtain and plot bootstrap sampling distribution of sample mean

Description

Obtain and plot bootstrap sampling distribution of sample mean

Usage

plot_dist(x)

Arguments

x

vector of (quantitative) data

Value

ggplot2 normal quantile plot of bootstrap sampling distribution

Examples

plot_dist(1:100)
plot_dist(mtcars$disp)

Obtain and plot bootstrap sampling distributions of sample means by group

Description

Obtain and plot bootstrap sampling distributions of sample means by group

Usage

plot_several(x, g)

Arguments

x

vector of observations

g

vector of groups that go with the observations

Value

ggplot graph of normal quantile plots, facetted

Examples

with(mtcars, plot_several(disp, cyl))