|
R demos
Back to all R demos
Confidence intervals
You can try out the function I used in lectures 14 and 15 to visualise confidence intervals.
- Download this file: ci.R to your computer, and save it (as ci.R)
- Start up R in the usual way
- In R, using the Source R code command (on the File menu), navigate to the appropriate folder, and select the file ci.R
- The function visualises sampling from a normal distribution with the stated mean and variance, and the construction of confidence intervals for the population mean using the method of section 7.3
- Run the demonstration by typing ci()
- You can control the simulation and display with the mouse and pointer
- If you click in the main part of the figure, the number of trials is increased
- If you click in the menu:
- You can choose to hide the data, or show it again
- You can change the sample size, and start again
- You can change the confidence level
- If you are interested in seeing how this is all done in R, and perhaps even modifying the actions, you can view the function by simply typing its name (without the () afterwards)
|