Chi-Squared Distribution#
Univariate, Continuous, Non-Negative, Light-tailed
The chi-squared (also chi-square or \(\chi^2\)) is a continuous probability distribution characterized by a single parameter, \(\nu\), usually called degrees of freedom. This distribution emerges from the sum of the squares of \(\nu\) independent standard normal random variables.
The chi-squared distribution is widely used in many statistical tests, for hypothesis testing and constructing confidence intervals.
Key properties and parameters#
Support |
\(x \in [0, \infty)\) |
Mean |
\(\nu\) |
Variance |
\(2\nu\) |
Parameters:
\(\nu\) : (float) Degrees of freedom, \(\nu > 0\).
Probability Density Function (PDF)#
where \(\Gamma\) is the gamma function.
/home/docs/checkouts/readthedocs.org/user_builds/preliz/envs/stable/lib/python3.11/site-packages/pytensor/link/c/cmodule.py:2986: UserWarning: PyTensor could not link to a BLAS installation. Operations that might benefit from BLAS will be severely degraded.
This usually happens when PyTensor is installed via pip. We recommend it be installed via conda/mamba/pixi instead.
Alternatively, you can use an experimental backend such as Numba or JAX that perform their own BLAS optimizations, by setting `pytensor.config.mode == 'NUMBA'` or passing `mode='NUMBA'` when compiling a PyTensor function.
For more options and details see https://pytensor.readthedocs.io/en/latest/troubleshooting.html#how-do-i-configure-test-my-blas-library
warnings.warn(
/home/docs/checkouts/readthedocs.org/user_builds/preliz/envs/stable/lib/python3.11/site-packages/pytensor/link/numba/dispatch/basic.py:211: UserWarning: Numba will use object mode to run XlogY0's perform method. Set `pytensor.config.compiler_verbose = True` to see more details.
warnings.warn(
Cumulative Distribution Function (CDF)#
where \(\gamma\) is the lower incomplete gamma function.
See also
Common Alternatives:
Gamma - The chi-squared distribution is a special case of the gamma distribution with the shape parameter \(\alpha = \nu/2\) and the scale parameter \(\beta = 1/2\).
Related Distributions:
Normal - By definition, the chi-squared distribution is the sum of the squares of \(\nu\) independent standard normal random variables.
Exponential - A chi-squared distribution with 2 degrees of freedom is equivalent to an exponential distribution with the rate parameter \(\lambda = 1/2\), because the exponential distribution is also a special case of the gamma distribution.