sim.ci.median1: Simulates confidence interval coverage probability for single...

View source: R/statpsych1.R

sim.ci.median1R Documentation

Simulates confidence interval coverage probability for single median

Description

Performs a computer simulation of the confidence interval performance for a single median. Sample data can be generated from five different population distributions. All distributions are scaled to have standard deviations of 1.0.

Usage

sim.ci.median1(alpha, n, dist, rep)

Arguments

alpha

alpha level for 1-alpha confidence

n

sample size

dist

type of distribution (1, 2, 3, 4, or 5)

  • 1 = Gaussian (skewness = 0 and excess kurtosis = 0)

  • 2 = platykurtic (skewness = 0 and excess kurtosis = -1.2)

  • 3 = leptokurtic (skewness = 0 and excess kurtsois = 6)

  • 4 = moderate skew (skewness = 1 and excess kurtosis = 1.5)

  • 5 = large skew (skewness = 2 and excess kurtosis = 6)

rep

number of Monte Carlo samples

Value

Returns a 1-row matrix. The columns are:

  • Coverage - probability of confidence interval including population median

  • Lower Error - probability of lower limit greater than population mediann

  • Upper Error - probability of upper limit less than population median

  • Ave CI Width - average confidence interval width

Examples

sim.ci.median1(.05, 20, 5, 1000)

# Should return (within sampling error):
#      Coverage Lower Error Upper Error Ave CI Width
# [1,]   0.9589      0.0216      0.0195    0.9735528



statpsych documentation built on July 9, 2023, 6:50 p.m.