Learn R Programming

QQreflimits (version 1.0.3)

para_limits: Parametric Limits, based on Normal

Description

Parametric confidence limit for a normal or normal-in-the-middle sample.

Usage

para_limits(mean, sd, N, censor=0, winsor=0, perc=0.95, cover=0.9)

Value

A list containing the following components:

lower

the lower reference limit and its CI

upper

the upper reference limit and its CI

effn

the effective sample size with censoring or winsorization

Arguments

mean

the mean of a complete normal sample, or the intercept of the QQ regression of a censored or winsorized sample.

sd

the sd of a complete normal sample, or the slope of the QQ regresion of a censorised or winsorized sample.

N

the sample size

censor

optional (default of 0) - the number of left-censored readings

winsor

optional (default of 0) - the number winsorized in each tail

perc

optional (default of 0.95) - the two-sided coverage sought

cover

optional (default of 0.9) - the confidence level of the CI on the reference limit

Author

Douglas M. Hawkins, Jessica J. Kraker krakerjj@uwec.edu

Details

This function computes two-sided reference limits and their confidence intervals for data that are normal; normal across the reference interval; or censored normal. The reference limits are conventional mean + z*se, and their confidence intervals come from the delta method.

References

Horn PS, Peske AJ (2005). Reference intervals: a user’s guide. Washington (DC): AACC Press.

Examples

Run this code
# parameters
mu    <- 40
sigma <- 10
n     <- 120
# identifying winsoring
wins  <- trunc(n/40)
# replicable randomization
set.seed(1069)
X     <- mu + sigma*rnorm(n)
# replicable randomization with heavy tails
set.seed(1069)
HT    <- mu + sigma * rt(n, 5)

# retain original visual settings
oldsettings <- par(mfrow=par()$mfrow, oma=par()$oma)
# visual settings
par(mfrow=c(2,2))
par(oma=c(0,0,2,0))
# plot to compare
base <- QQnorm(X, main="Base normal", showsum=TRUE)
title("Illustrating QQnorm with para_limits", outer=TRUE)
basew <- QQnorm(X, main="Winsorized", winsor=wins, showsum=TRUE)
ht   <- QQnorm(HT, main="Heavy tail", showsum=TRUE)
htw  <- QQnorm(HT, main="Winsorized", winsor=wins, showsum=TRUE)
# restore
par(oldsettings)

# evaluate and review
norm_results <- para_limits(mean(X), sd(X), n)
norm_results
# evaluate and review with tails
tailed_results <- para_limits(htw$intercept, htw$slope, n, winsor=wins)
tailed_results

Run the code above in your browser using DataLab