Learn R Programming

mosaic (version 0.13.0)

qdist: Illustrated quantile calculations from distributions

Description

Illustrated quantile calculations from distributions

Usage

qdist(dist = "norm", p, plot = TRUE, verbose = FALSE, invisible = FALSE,
  resolution = 5000L, digits = 4L, xlim, ylim, vlwd = NULL,
  vcol = trellis.par.get("add.line")$col, rot = 45, ...)

xqgamma(...)

xqt(...)

xqchisq(...)

xqf(...)

xqbinom(...)

xqpois(...)

xqgeom(...)

xqnbinom(...)

Arguments

dist
a character discription of a distribution, for example "norm", "t", or "chisq"
p
a vector of probabilities
plot
a logical indicating whether a plot should be created
verbose
a logical
invisible
a logical
resolution
number of points used for detecting discreteness and generating plots. The defaut value of 5000 should work well except for discrete distributions that have many distinct values, especially if these values are not evenly spaced.
digits
the number of digits desired
xlim
x limits. By default, these are chosen to show the central 99.8% of the distribution.
ylim
y limits
vlwd
width of vertical lines
vcol
color of vertical lines
rot
angle for rotating text indicating probability
...
additional arguments, including parameters of the distribution and additional options for the plot

Value

  • a vector of quantiles; a plot is printed as a side effect

Details

The most general function is qdist which can work with any distribution for which a q-function exists. As a convenience, wrappers are provided for several common distributions.

Examples

Run this code
qdist("norm", seq(.2, .8, by = 0.10))
xqnorm(seq(.2, .8, by = 0.10), mean = 100, sd = 10)
qdist("unif", .5)
xqgamma(.5, shape = 3, scale = 4)
xqchisq(c(.25,.5,.75), df = 3)
xpbinom( c(480, 500, 510), size = 1000, prob = 0.48)
xpbinom( c(40, 60), size = 100, prob = 0.5)
xqpois( c(0.25, 0.5, 0.75), lambda = 6, lwd = 3, vlwd = 2)

Run the code above in your browser using DataLab