Learn R Programming

adehabitatLT (version 0.1)

Chi: The Chi Distribution

Description

Density, distribution function, quantile function and random generation for the chi distribution with df degrees of freedom.

Usage

dchi(x, df = 2)
pchi(q, df = 2, lower.tail = TRUE, ...)
qchi(p, df = 2, lower.tail = TRUE)
rchi(n, df = 2)

Arguments

x,q
vector of quantiles.
p
vector of probabilities.
n
number of observations. If length(n) > 1, the length is taken to be the number required.
df
degrees of freedom (non-negative, but can be non-integer).
lower.tail
logical; if TRUE (default), probabilities are P[X <= x],="" otherwise,="" p[x=""> x].
...
additional arguments to be passed to the function integrate.

Value

  • dchi gives the density, pchisq gives the distribution function, qchisq gives the quantile function, and rchisq generates random deviates.

Details

The chi distribution with df = n > 0 degrees of freedom has density $$f_n (x) = 2^{1-n/2} x^{n-1} e^{\frac{-(x^2)}{2}} / \Gamma (n/2)$$ for x > 0. This distribution is used to describe the square root of a variable distributed according to a chi-square distribution.

References

Evans, M., Hastings, N. and Peacock, B. (2000) Statistical Distributions, 3rd ed. Wiley, New York.

See Also

Chisquare

Examples

Run this code
opar <- par(mfrow = c(2,2))

hist(rchi(100), ncla = 20, main="The Chi distribution")

plot(tutu <- seq(0, 5, length=20), dchi(tutu, df = 2), xlab = "x",
     ylab = "probability density", type = "l")

plot(tutu, pchi(tutu), xlab = "x", ylab = "Repartition function",
     type = "l")

par(opar)

Run the code above in your browser using DataLab