mosaic (version 1.1.0)

cdist: Central portion of a distribution

Description

This function determines the critial values for isolating a central portion of a distribution with a specified probability. This is designed to work especially well for symmteric distributions, but it can be used with any distribution.

Usage

cdist(dist, p, ..., verbose = FALSE)

Arguments

dist

a character string naming a distribution family (e.g., "norm"). This wil work for any family for which the usual d/p/q functions exist.

p

the proportion to be in the central region, with equal proportions in either "tail".

...

additional arguments passed to the distribution functions. Typically these specify the parameters of the particular distribution desired. See the examples.

verbose

a logical indicating whether a more verbose output value should be returned.

Value

a pair of numbers indicating the upper and lower bounds, unless verbose is TRUE, in which case a 1-row data frame is returned containing these bounds, the central probability, the tail probabilities, and the name of the distribution.

Examples

Run this code
# NOT RUN {
cdist( "norm", .95)
cdist( "t", c(.90, .95, .99), df=5)
cdist( "t", c(.90, .95, .99), df=50)
cdist( "t", .95, df=c(3,5,10,20))
cdist( "t", .95, df=c(3,5,10,20), verbose = TRUE )
cdist( "norm", .95, mean=500, sd=100 )
cdist( "chisq", c(.90, .95), df=3 )
# CI
x <- rnorm(23, mean = 10, sd = 2)
cdist("t", p = 0.95, df=22)
mean(x) + cdist("t", p = 0.95, df=22) * sd(x) / sqrt(23)
confint(t.test(x))
cdist("t", p = 0.95, df=22, verbose = TRUE)
# }

Run the code above in your browser using DataLab