# Distributions¶

A distribution is the final component of an ARCH Model.

## Normal¶

class arch.univariate.Normal(random_state=None)[source]

Standard normal distribution for use with ARCH models

bounds(resids)[source]
Parameters: resids (ndarray) – Residuals to use when computing the bounds bounds – List containing a single tuple with (lower, upper) bounds list
constraints()[source]

Notes

Parameters satisfy the constraints A.dot(parameters)-b >= 0

loglikelihood(parameters, resids, sigma2, individual=False)[source]

Computes the log-likelihood of assuming residuals are normally distributed, conditional on the variance

Parameters: parameters (ndarray) – The normal likelihood has no shape parameters. Empty since the standard normal has no shape parameters. resids (ndarray) – The residuals to use in the log-likelihood calculation sigma2 (ndarray) – Conditional variances of resids individual (bool, optional) – Flag indicating whether to return the vector of individual log likelihoods (True) or the sum (False) ll – The log-likelihood float

Notes

The log-likelihood of a single data point x is

$\ln f\left(x\right)=-\frac{1}{2}\left(\ln2\pi+\ln\sigma^{2} +\frac{x^{2}}{\sigma^{2}}\right)$
simulate(parameters)[source]

Simulates i.i.d. draws from the distribution

Parameters: parameters (ndarray) – Distribution parameters simulator – Callable that take a single output size argument and returns i.i.d. draws from the distribution callable
starting_values(std_resid)[source]
Parameters: std_resid (ndarray) – Estimated standardized residuals to use in computing starting values for the shape parameter sv – The estimated shape parameters for the distribution ndarray

Notes

Size of sv depends on the distribution

## Student’s t¶

class arch.univariate.StudentsT(random_state=None)[source]

Standardized Student’s distribution for use with ARCH models

bounds(resids)[source]
Parameters: resids (ndarray) – Residuals to use when computing the bounds bounds – List containing a single tuple with (lower, upper) bounds list
constraints()[source]

Notes

Parameters satisfy the constraints A.dot(parameters)-b >= 0

loglikelihood(parameters, resids, sigma2, individual=False)[source]

Computes the log-likelihood of assuming residuals are have a standardized (to have unit variance) Student’s t distribution, conditional on the variance.

Parameters: parameters (ndarray) – Shape parameter of the t distribution resids (ndarray) – The residuals to use in the log-likelihood calculation sigma2 (ndarray) – Conditional variances of resids individual (bool, optional) – Flag indicating whether to return the vector of individual log likelihoods (True) or the sum (False) ll – The log-likelihood float

Notes

The log-likelihood of a single data point x is

$\ln\Gamma\left(\frac{\nu+1}{2}\right) -\ln\Gamma\left(\frac{\nu}{2}\right) -\frac{1}{2}\ln(\pi\left(\nu-2\right)\sigma^{2}) -\frac{\nu+1}{2}\ln(1+x^{2}/(\sigma^{2}(\nu-2)))$

where $$\Gamma$$ is the gamma function.

simulate(parameters)[source]

Simulates i.i.d. draws from the distribution

Parameters: parameters (ndarray) – Distribution parameters simulator – Callable that take a single output size argument and returns i.i.d. draws from the distribution callable
starting_values(std_resid)[source]
Parameters: std_resid (ndarray) – Estimated standardized residuals to use in computing starting values for the shape parameter sv – Array containing starting valuer for shape parameter ndarray

Notes

Uses relationship between kurtosis and degree of freedom parameter to produce a moment-based estimator for the starting values.

## Skew Student’s t¶

class arch.univariate.SkewStudent(random_state=None)[source]

Standardized Skewed Student’s [1] distribution for use with ARCH models

Notes

The Standardized Skewed Student’s distribution takes two parameters, $$\eta$$ and $$\lambda$$. $$\eta$$ controls the tail shape and is similar to the shape parameter in a Standardized Student’s t. $$\lambda$$ controls the skewness. When $$\lambda=0$$ the distribution is identical to a standardized Student’s t.

References

 [1] Hansen, B. E. (1994). Autoregressive conditional density estimation. International Economic Review, 35(3), 705–730.
bounds(resids)[source]
Parameters: resids (ndarray) – Residuals to use when computing the bounds bounds – List containing a single tuple with (lower, upper) bounds list
constraints()[source]

Notes

Parameters satisfy the constraints A.dot(parameters)-b >= 0

loglikelihood(parameters, resids, sigma2, individual=False)[source]

Computes the log-likelihood of assuming residuals are have a standardized (to have unit variance) Skew Student’s t distribution, conditional on the variance.

Parameters: parameters (ndarray) – Shape parameter of the skew-t distribution resids (ndarray) – The residuals to use in the log-likelihood calculation sigma2 (ndarray) – Conditional variances of resids individual (bool, optional) – Flag indicating whether to return the vector of individual log likelihoods (True) or the sum (False) ll – The log-likelihood float

Notes

The log-likelihood of a single data point x is

$\ln\left[\frac{bc}{\sigma}\left(1+\frac{1}{\eta-2} \left(\frac{a+bx/\sigma} {1+sgn(x/\sigma+a/b)\lambda}\right)^{2}\right) ^{-\left(\eta+1\right)/2}\right],$

where $$2<\eta<\infty$$, and $$-1<\lambda<1$$. The constants $$a$$, $$b$$, and $$c$$ are given by

$a=4\lambda c\frac{\eta-2}{\eta-1}, \quad b^{2}=1+3\lambda^{2}-a^{2}, \quad c=\frac{\Gamma\left(\frac{\eta+1}{2}\right)} {\sqrt{\pi\left(\eta-2\right)} \Gamma\left(\frac{\eta}{2}\right)},$

and $$\Gamma$$ is the gamma function.

simulate(parameters)[source]

Simulates i.i.d. draws from the distribution

Parameters: parameters (ndarray) – Distribution parameters simulator – Callable that take a single output size argument and returns i.i.d. draws from the distribution callable
starting_values(std_resid)[source]
Parameters: std_resid (ndarray) – Estimated standardized residuals to use in computing starting values for the shape parameter sv – Array containing starting valuer for shape parameter ndarray

Notes

Uses relationship between kurtosis and degree of freedom parameter to produce a moment-based estimator for the starting values.

## Generalized Error (GED)¶

class arch.univariate.GeneralizedError(random_state=None)[source]

Generalized Error distribution for use with ARCH models

bounds(resids)[source]
Parameters: resids (ndarray) – Residuals to use when computing the bounds bounds – List containing a single tuple with (lower, upper) bounds list
constraints()[source]

Notes

Parameters satisfy the constraints A.dot(parameters)-b >= 0

loglikelihood(parameters, resids, sigma2, individual=False)[source]

Computes the log-likelihood of assuming residuals are have a Generalized Error Distribution, conditional on the variance.

Parameters: parameters (ndarray) – Shape parameter of the GED distribution resids (ndarray) – The residuals to use in the log-likelihood calculation sigma2 (ndarray) – Conditional variances of resids individual (bool, optional) – Flag indicating whether to return the vector of individual log likelihoods (True) or the sum (False) ll – The log-likelihood float

Notes

The log-likelihood of a single data point x is

$\ln\nu-\ln c-\ln\Gamma(\frac{1}{\nu})+(1+\frac{1}{\nu})\ln2 -\frac{1}{2}\ln\sigma^{2} -\frac{1}{2}\left|\frac{x}{c\sigma}\right|^{\nu}$

where $$\Gamma$$ is the gamma function and $$\ln c$$ is

$\ln c=\frac{1}{2}\left(\frac{-2}{\nu}\ln2+\ln\Gamma(\frac{1}{\nu}) -\ln\Gamma(\frac{3}{\nu})\right).$
simulate(parameters)[source]

Simulates i.i.d. draws from the distribution

Parameters: parameters (ndarray) – Distribution parameters simulator – Callable that take a single output size argument and returns i.i.d. draws from the distribution callable
starting_values(std_resid)[source]
Parameters: std_resid (ndarray) – Estimated standardized residuals to use in computing starting values for the shape parameter sv – Array containing starting valuer for shape parameter ndarray

Notes

Defaults to 1.5 which is implies heavier tails than a normal

## Writing New Distributions¶

All distributions must inherit from :class:Distribution and provide all public methods.

class arch.univariate.Distribution(name, random_state=None)[source]

Template for subclassing only