| 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 |
Selling prices of 3-bedroom and 4-bedroom homes in West Lafayette, Indiana
home_priceshome_prices
A dataframe with 37 rows and 2 columns:
Selling price in US $
Number of bedrooms (3 or 4)
http://ritsokiguess.site/datafiles/homes.csv
Generate bootstrap samples and calculate sample means
make_dist(x, nsim = 100)make_dist(x, nsim = 100)
x |
vector of data to sample from |
nsim |
number of bootstrap samples |
dataframe containing column x_mean
make_dist(1:5, 20) make_dist(mtcars$disp, 30)make_dist(1:5, 20) make_dist(mtcars$disp, 30)
Obtain bootstrap sampling distributions for several samples
make_several(x, g = "a", nsim = 10000)make_several(x, g = "a", nsim = 10000)
x |
vector of observations |
g |
vector of group membership of each observation |
nsim |
number of bootstrap samples to draw for each group |
dataframe containing columns x_mean containing bootstrap sample and group,
group for which that bootstrap sample was drawn
with(mtcars, make_several(disp, cyl, 5))with(mtcars, make_several(disp, cyl, 5))
Obtain and plot bootstrap sampling distribution of sample mean
plot_dist(x)plot_dist(x)
x |
vector of (quantitative) data |
ggplot2 normal quantile plot of bootstrap sampling distribution
plot_dist(1:100) plot_dist(mtcars$disp)plot_dist(1:100) plot_dist(mtcars$disp)
Obtain and plot bootstrap sampling distributions of sample means by group
plot_several(x, g)plot_several(x, g)
x |
vector of observations |
g |
vector of groups that go with the observations |
ggplot graph of normal quantile plots, facetted
with(mtcars, plot_several(disp, cyl))with(mtcars, plot_several(disp, cyl))