# Generalized Dirichlet distribution

In statistics, the generalized Dirichlet distribution (GD) is a generalization of the Dirichlet distribution with a more general covariance structure and almost twice the number of parameters. Random variables with a GD distribution are not completely neutral .[1]

The density function of ${\displaystyle p_{1},\ldots ,p_{k-1}}$ is

${\displaystyle \left[\prod _{i=1}^{k-1}B(a_{i},b_{i})\right]^{-1}p_{k}^{b_{k-1}-1}\prod _{i=1}^{k-1}\left[p_{i}^{a_{i}-1}\left(\sum _{j=i}^{k}p_{j}\right)^{b_{i-1}-(a_{i}+b_{i})}\right]}$

where we define ${\textstyle p_{k}=1-\sum _{i=1}^{k-1}p_{i}}$. Here ${\displaystyle B(x,y)}$ denotes the Beta function. This reduces to the standard Dirichlet distribution if ${\displaystyle b_{i-1}=a_{i}+b_{i}}$ for ${\displaystyle 2\leqslant i\leqslant k-1}$ (${\displaystyle b_{0}}$ is arbitrary).

For example, if k=4, then the density function of ${\displaystyle p_{1},p_{2},p_{3}}$ is

${\displaystyle \left[\prod _{i=1}^{3}B(a_{i},b_{i})\right]^{-1}p_{1}^{a_{1}-1}p_{2}^{a_{2}-1}p_{3}^{a_{3}-1}p_{4}^{b_{3}-1}\left(p_{2}+p_{3}+p_{4}\right)^{b_{1}-\left(a_{2}+b_{2}\right)}\left(p_{3}+p_{4}\right)^{b_{2}-\left(a_{3}+b_{3}\right)}}$

where ${\displaystyle p_{1}+p_{2}+p_{3}<1}$ and ${\displaystyle p_{4}=1-p_{1}-p_{2}-p_{3}}$.

Connor and Mosimann define the PDF as they did for the following reason. Define random variables ${\displaystyle z_{1},\ldots ,z_{k-1}}$ with ${\displaystyle z_{1}=p_{1},z_{2}=p_{2}/\left(1-p_{1}\right),z_{3}=p_{3}/\left(1-(p_{1}+p_{2})\right),\ldots ,z_{i}=p_{i}/\left(1-\left(p_{1}+\cdots +p_{i-1}\right)\right)}$. Then ${\displaystyle p_{1},\ldots ,p_{k}}$ have the generalized Dirichlet distribution as parametrized above, if the ${\displaystyle z_{i}}$ are independent beta with parameters ${\displaystyle a_{i},b_{i}}$, ${\displaystyle i=1,\ldots ,k-1}$.

## Alternative form given by Wong

Wong [2] gives the slightly more concise form for ${\displaystyle x_{1}+\cdots +x_{k}\leq 1}$

${\displaystyle \prod _{i=1}^{k}{\frac {x_{i}^{\alpha _{i}-1}\left(1-x_{1}-\cdots -x_{i}\right)^{\gamma _{i}}}{B(\alpha _{i},\beta _{i})}}}$

where ${\displaystyle \gamma _{j}=\beta _{j}-\alpha _{j+1}-\beta _{j+1}}$ for ${\displaystyle 1\leq j\leq k-1}$ and ${\displaystyle \gamma _{k}=\beta _{k}-1}$. Note that Wong defines a distribution over a ${\displaystyle k}$ dimensional space (implicitly defining ${\textstyle x_{k+1}=1-\sum _{i=1}^{k}x_{i}}$) while Connor and Mosiman use a ${\displaystyle k-1}$ dimensional space with ${\textstyle x_{k}=1-\sum _{i=1}^{k-1}x_{i}}$.

## General moment function

If ${\displaystyle X=\left(X_{1},\ldots ,X_{k}\right)\sim GD_{k}\left(\alpha _{1},\ldots ,\alpha _{k};\beta _{1},\ldots ,\beta _{k}\right)}$, then

${\displaystyle E\left[X_{1}^{r_{1}}X_{2}^{r_{2}}\cdots X_{k}^{r_{k}}\right]=\prod _{j=1}^{k}{\frac {\Gamma \left(\alpha _{j}+\beta _{j}\right)\Gamma \left(\alpha _{j}+r_{j}\right)\Gamma \left(\beta _{j}+\delta _{j}\right)}{\Gamma \left(\alpha _{j}\right)\Gamma \left(\beta _{j}\right)\Gamma \left(\alpha _{j}+\beta _{j}+r_{j}+\delta _{j}\right)}}}$

where ${\displaystyle \delta _{j}=r_{j+1}+r_{j+2}+\cdots +r_{k}}$ for ${\displaystyle j=1,2,\cdots ,k-1}$ and ${\displaystyle \delta _{k}=0}$. Thus

${\displaystyle E\left(X_{j}\right)={\frac {\alpha _{j}}{\alpha _{j}+\beta _{j}}}\prod _{m=1}^{j-1}{\frac {\beta _{m}}{\alpha _{m}+\beta _{m}}}.}$

## Reduction to standard Dirichlet distribution

As stated above, if ${\displaystyle b_{i-1}=a_{i}+b_{i}}$ for ${\displaystyle 2\leq i\leq k}$ then the distribution reduces to a standard Dirichlet. This condition is different from the usual case, in which setting the additional parameters of the generalized distribution to zero results in the original distribution. However, in the case of the GDD, this results in a very complicated density function.

## Bayesian analysis

Suppose ${\displaystyle X=\left(X_{1},\ldots ,X_{k}\right)\sim GD_{k}\left(\alpha _{1},\ldots ,\alpha _{k};\beta _{1},\ldots ,\beta _{k}\right)}$ is generalized Dirichlet, and that ${\displaystyle Y\mid X}$ is multinomial with ${\displaystyle n}$ trials (here ${\displaystyle Y=\left(Y_{1},\ldots ,Y_{k}\right)}$). Writing ${\displaystyle Y_{j}=y_{j}}$ for ${\displaystyle 1\leq j\leq k}$ and ${\textstyle y_{k+1}=n-\sum _{i=1}^{k}y_{i}}$ the joint posterior of ${\displaystyle X|Y}$ is a generalized Dirichlet distribution with

${\displaystyle X\mid Y\sim GD_{k}\left({\alpha '}_{1},\ldots ,{\alpha '}_{k};{\beta '}_{1},\ldots ,{\beta '}_{k}\right)}$

where ${\displaystyle {\alpha '}_{j}=\alpha _{j}+y_{j}}$ and ${\displaystyle {\beta '}_{j}=\beta _{j}+\sum _{i=j+1}^{k+1}y_{i}}$ for ${\displaystyle 1\leqslant k.}$

## Sampling experiment

Wong gives the following system as an example of how the Dirichlet and generalized Dirichlet distributions differ. He posits that a large urn contains balls of ${\displaystyle k+1}$ different colours. The proportion of each colour is unknown. Write ${\displaystyle X=(X_{1},\ldots ,X_{k})}$ for the proportion of the balls with colour ${\displaystyle j}$ in the urn.

Experiment 1. Analyst 1 believes that ${\displaystyle X\sim D(\alpha _{1},\ldots ,\alpha _{k},\alpha _{k+1})}$ (ie, ${\displaystyle X}$ is Dirichlet with parameters ${\displaystyle \alpha _{i}}$). The analyst then makes ${\displaystyle k+1}$ glass boxes and puts ${\displaystyle \alpha _{i}}$ marbles of colour ${\displaystyle i}$ in box ${\displaystyle i}$ (it is assumed that the ${\displaystyle \alpha _{i}}$ are integers ${\displaystyle \geq 1}$). Then analyst 1 draws a ball from the urn, observes its colour (say colour ${\displaystyle j}$) and puts it in box ${\displaystyle j}$. He can identify the correct box because they are transparent and the colours of the marbles within are visible. The process continues until ${\displaystyle n}$ balls have been drawn. The posterior distribution is then Dirichlet with parameters being the number of marbles in each box.

Experiment 2. Analyst 2 believes that ${\displaystyle X}$ follows a generalized Dirichlet distribution: ${\displaystyle X\sim GD(\alpha _{1},\ldots ,\alpha _{k};\beta _{1},\ldots ,\beta _{k})}$. All parameters are again assumed to be positive integers. The analyst makes ${\displaystyle k+1}$ wooden boxes. The boxes have two areas: one for balls and one for marbles. The balls are coloured but the marbles are not coloured. Then for ${\displaystyle j=1,\ldots ,k}$, he puts ${\displaystyle \alpha _{j}}$ balls of colour ${\displaystyle j}$, and ${\displaystyle \beta _{j}}$ marbles, in to box ${\displaystyle j}$. He then puts a ball of colour ${\displaystyle k+1}$ in box ${\displaystyle k+1}$. The analyst then draws a ball from the urn. Because the boxes are wood, the analyst cannot tell which box to put the ball in (as he could in experiment 1 above); he also has a poor memory and cannot remember which box contains which colour balls. He has to discover which box is the correct one to put the ball in. He does this by opening box 1 and comparing the balls in it to the drawn ball. If the colours differ, the box is the wrong one. The analyst puts a marble (sic) in box 1 and proceeds to box 2. He repeats the process until the balls in the box match the drawn ball, at which point he puts the ball (sic) in the box with the other balls of matching colour. The analyst then draws another ball from the urn and repeats until ${\displaystyle n}$ balls are drawn. The posterior is then generalized Dirichlet with parameters ${\displaystyle \alpha }$ being the number of balls, and ${\displaystyle \beta }$ the number of marbles, in each box.

Note that in experiment 2, changing the order of the boxes has a non-trivial effect, unlike experiment 1.