multiple.pi.sim: Prediction Intervals Simulation

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

multiple.pi.simR Documentation

Prediction Intervals Simulation

Description

Simulation to illustrate the effect that confidence level and sample size have on the results of prediction interval width and correctness. Simulated samples are used to compute the prediction intervals and then one additional observation is generated and plotted for each inerval. If the additional observation does not fall in the prodiction interval, the interval is marked in red.

Usage

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

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 prediction 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.

Examples

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


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