multiple.ci.sim: Confidence Interval Simulation

View source: R/multiple.ci.sim.R

multiple.ci.simR Documentation

Confidence Interval Simulation

Description

Simulation to illustrate the effect that confidence level and sample size have on the results of confidence interval width and correctness.

Usage

multiple.ci.sim(
  sample.sizes = c(30, 120),
  confidence.levels = c(0.8, 0.95),
  mu = 100,
  sigma = 10,
  number.simulations = 100,
  scale = 2.5
)

Arguments

sample.sizes

A vector of sample sizes. Length 2 is recommended. Default is sample.sizes=c(30, 120)

confidence.levels

A vector of confidence levels. Length 2 is recommended. Default is confidence.levels=c(0.8, 0.95)

mu

Mean of the distribution from which samples are taken (default is 100)

sigma

Standard deviation of the distribution from which samples are taken (default is 10).

number.simulations

Number of confidence intervals to be simulated (default is 100).

scale

Scale factor that determines the scale of the common y-axis of the plots. The default is 2. A larger number would allow more white space around edges. A smaller number might allow some of the interval endpoints to be outside of the plots.

Details

If the lengths of sample.sizes and confidence.levels are both 2, the output is in the form of a 2 x 2 factorial that shows the effect that sample size and confidence level have on the width and probability of correctness of a sequence of prediction intervals. Each time the function is executed, different simulated data sets led to different sets of confidence inervals to be plotted.

Examples

multiple.ci.sim()
multiple.ci.sim(sample.sizes = c(10, 40))
multiple.ci.sim(confidence.levels = c(0.95, 0.99))
multiple.ci.sim(sample.sizes = c(10, 40), confidence.levels = c(0.95, 0.99))


wqmeeker/RTseries documentation built on Dec. 31, 2022, 10 a.m.