simMeans {lessR}R Documentation

Pedagogical Simulation of Sample Means over Repeated Samples

Description

Show a sequence of sample means and data, all simulated from the same normal population. Useful for developing an intuition for developing an informal confidence interval, that is, specifying a likely range of values that contain the true population mean, but without a formal probability.

Usage

simMeans(ns, n, mu=0, sigma=1, seed=NULL, 
         show_title=TRUE, show_data=TRUE, max_data=10, 
         grid="grey90", ylim_bound=NULL, pause=FALSE,
         sort=NULL, set_mu=FALSE, digits_d=2,
         main=NULL, pdf_file=NULL, width=5, height=5, ...)

Arguments

ns

Number of samples, that is, repetitions of the experiment.

n

Size of each sample.

mu

Population mean.

sigma

Population standard deviation.

seed

Default seed is the R default. Enter a positive integer value to obtain a reproducible result, the same result for the same seed.


show_title

Place a title on the graph that contains the parameter values_

show_data

Show the data values on the text output.

max_data

Maximum number of data values per sample on the text output.

grid

Color of the grid lines.

ylim_bound

Specify the maximum deviation of the mean in either direction for the extent of the vertical axis_

pause

Build the graph and the text output sample by sample.


sort

Sort the output by the means in ascending order. By default is TRUE unless se.mu or pause is TRUE.

set_mu

Have the program randomly set mu and sigma, usually to guess the correct value.

digits_d

Sort the output by the means in ascending order.

main

Title of graph.


pdf_file

Name of the pdf file to which graphics are redirected.

width

Width of the pdf file in inches.

height

Height of the pdf file in inches.

...

Other parameter values.

Details

Simulate random normal data and display the resulting sample means, both as text output and graphic output.

If pause=TRUE, then the true population values are not revealed as the simulation progresses. These values are saved in the user's workspace and can be revealed by entering their names at the user prompt, mu and sigma.

Author(s)

David W. Gerbing (Portland State University; gerbing@pdx.edu)

Examples

# 8 samples, each with a sample size of 10
# mu=0, sigma=1, that is, sample from the standard normal
simMeans(8, 10)

# 25 sample means with a sample size each of 100
# mu=100, sigma=15
# pause after each interval and show the data
simMeans(25, 100, mu=100, sigma=15, show_data=FALSE)

[Package lessR version 4.3.6 Index]