size.ci.median: Sample size for a median confidence interval

View source: R/statpsych1.R

size.ci.medianR Documentation

Sample size for a median confidence interval

Description

Computes the sample size required to estimate a population median with desired confidence interval precision. Set the variance planning value to the largest value within a plausible range for a conservatively large sample size. The sample size requirement depends on the shape of the distribution. Select one of the four distribution options (Normal, Logistic, Laplace, Exponential) that approximates the most likely distribution shape in the planned study. Select the Normal distribution for a conservatively large sample size requirement.

Usage

size.ci.median(alpha, var, w, dist)

Arguments

alpha

alpha level for 1-alpha confidence

var

planning value of response variable variance

w

desired confidence interval width

dist
  • set to 1 for Normal distribution (skew = 0, kurtosis = 3)

  • set to 2 for Logistic distribution (skew = 0, kurtosis = 4.2)

  • set to 3 for Laplace distribution (skew = 0, kurtosis = 6)

  • set to 4 for Gamma(5) (skew = .89, kurtosis = 4.2)

  • set to 5 for Exponential distribution (skew = 2, kurtosis = 9)

Value

Returns the required sample size

References

\insertRef

Bonett2002statpsych

Examples

size.ci.median(.05, 264.4, 10, 1)

# Should return:
# Sample size
#          64
 
size.ci.median(.05, 264.4, 10, 3)

# Should return:
# Sample size
#          21



statpsych documentation built on June 10, 2025, 5:11 p.m.