Interactively Demonstrate Confidence Intervals
ShinyConfIntExamp.RdLaunches a Shiny app wrapping ci.examp: it draws
several samples from a specified normal population and plots the
confidence interval computed from each sample, along with the true
population mean, so you can see what proportion of the intervals
contain the true value.
Usage
ShinyConfIntExamp(mean.sim = 100, sd = 10, n = 25, reps = 50,
method = c("z", "t", "both"), conf.level = 0.95)Arguments
- mean.sim
Initial population mean.
- sd
Initial population standard deviation.
- n
Initial sample size for each simulated sample.
- reps
Initial number of samples (confidence intervals) to draw.
- method
Initial method:
"z"uses the population SD,"t"estimates the standard error from each sample, and"both"shows both intervals together for comparison.- conf.level
Initial confidence level.
Details
This function requires the shiny package to be installed. Use the “New Seed” button to redraw a fresh set of samples with the current settings.
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 <- ShinyConfIntExamp()
# h$stop() # run this when finished with the app
}