Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dist_chisq

The (non-central) Chi-Squared Distribution


Description

[Stable]

Usage

dist_chisq(df, ncp = 0)

Arguments

df

degrees of freedom (non-negative, but can be non-integer).

ncp

non-centrality parameter (non-negative).

Details

Chi-square distributions show up often in frequentist settings as the sampling distribution of test statistics, especially in maximum likelihood estimation settings.

We recommend reading this documentation on https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.

In the following, let X be a χ^2 random variable with df = k.

Support: R^+, the set of positive real numbers

Mean: k

Variance: 2k

Probability density function (p.d.f):

f(x) = 1 / (2 π σ^2) exp(-(x - μ)^2 / (2 σ^2))

Cumulative distribution function (c.d.f):

The cumulative distribution function has the form

F(t) = integral_{-∞}^t 1 / (2 π σ^2) exp(-(x - μ)^2 / (2 σ^2)) dx

but this integral does not have a closed form solution and must be approximated numerically. The c.d.f. of a standard normal is sometimes called the "error function". The notation Φ(t) also stands for the c.d.f. of a standard normal evaluated at t. Z-tables list the value of Φ(t) for various t.

Moment generating function (m.g.f):

E(e^(tX)) = e^(μ t + σ^2 t^2 / 2)

See Also

Examples

dist <- dist_chisq(df = c(1,2,3,4,6,9))

dist
mean(dist)
variance(dist)
skewness(dist)
kurtosis(dist)

generate(dist, 10)

density(dist, 2)
density(dist, 2, log = TRUE)

cdf(dist, 4)

quantile(dist, 0.7)

distributional

Vectorised Probability Distributions

v0.2.2
GPL-3
Authors
Mitchell O'Hara-Wild [aut, cre] (<https://orcid.org/0000-0001-6729-7695>), Earo Wang [ctb] (<https://orcid.org/0000-0001-6448-5260>), Matthew Kay [ctb] (<https://orcid.org/0000-0001-9446-0419>), Alex Hayes [aut] (<https://orcid.org/0000-0002-4985-5160>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.