Interactively Demonstrate the Sampling Distribution of the Mean
ShinySamplingDistMean.RdLaunches a Shiny app that shows a skewed “population” distribution along with its mean and standard deviation. Clicking “Sample Once” draws a sample and shows it along with its mean; sampling in batches accumulates many sample means into a histogram approximating the sampling distribution of the mean.
Details
This function requires the shiny package to be installed. Set the sample size, then use the “Sample Once”, “Sample 5”, “Sample 100”, or “Sample 1,000” buttons to draw samples from the (fixed) skewed population. A single sample is shown as a histogram; multiple individual samples are shown as boxplots. All sampled means accumulate into the sampling distribution histogram at the bottom. Changing the sample size resets the accumulated samples.
Value
Launches the app in non-blocking mode (via
startApp) and returns a ShinyAppHandle
immediately, so the R console remains available while the app runs
in the background. Use handle$stop() to stop the app.
Author
Greg Snow 538280@gmail.com
Examples
if(interactive()) {
h <- ShinySamplingDistMean()
# h$stop() # run this when finished with the app
}