Chi {EnvStats} R Documentation

## The Chi Distribution

### Description

Density, distribution function, quantile function, and random generation for the chi distribution.

### Usage

  dchi(x, df)
pchi(q, df)
qchi(p, df)
rchi(n, df)


### Arguments

 x vector of (positive) quantiles. q vector of (positive) quantiles. p vector of probabilities between 0 and 1. n sample size. If length(n) is larger than 1, then length(n) random values are returned. df vector of (positive) degrees of freedom (> 0). Non-integer values are allowed.

### Details

Elements of x, q, p, or df that are missing will cause the corresponding elements of the result to be missing.

The chi distribution with n degrees of freedom is the distribution of the positive square root of a random variable having a chi-squared distribution with n degrees of freedom.

The chi density function is given by:

f(x, \nu) = g(x^2, \nu) 2x, x > 0

where g(x,\nu) denotes the density function of a chi-square random variable with n degrees of freedom.

### Value

density (dchi), probability (pchi), quantile (qchi), or random sample (rchi) for the chi distribution with df degrees of freedom.

### Note

The chi distribution takes on positive real values. It is important because for a sample of n observations from a normal distribution, the sample standard deviation multiplied by the square root of the degrees of freedom \nu and divided by the true standard deviation follows a chi distribution with \nu degrees of freedom. The chi distribution is also used in computing exact prediction intervals for the next k observations from a normal distribution (see predIntNorm).

### Author(s)

Steven P. Millard (EnvStats@ProbStatInfo.com)

### References

Forbes, C., M. Evans, N. Hastings, and B. Peacock. (2011). Statistical Distributions. Fourth Edition. John Wiley and Sons, Hoboken, NJ.

Johnson, N. L., S. Kotz, and N. Balakrishnan. (1995). Continuous Univariate Distributions, Volume 1. Second Edition. John Wiley and Sons, New York.

Chisquare, Normal, predIntNorm, Probability Distributions and Random Numbers.

### Examples

  # Density of a chi distribution with 4 degrees of freedom, evaluated at 3:

dchi(3, 4)
#[1] 0.1499715

#----------

# The 95'th percentile of a chi distribution with 10 degrees of freedom:

qchi(.95, 10)
#[1] 4.278672

#----------

# The cumulative distribution function of a chi distribution with
# 5 degrees of freedom evaluated at 3:

pchi(3, 5)
#[1] 0.8909358

#----------

# A random sample of 2 numbers from a chi distribution with 7 degrees of freedom.
# (Note: the call to set.seed simply allows you to reproduce this example.)

set.seed(20)
rchi(2, 7)
#[1] 3.271632 2.035179


[Package EnvStats version 2.8.1 Index]