% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dewens.R
\name{dewens}
\alias{dewens}
\title{Probability mass function for the Ewens distribution}
\usage{
dewens(x, theta = 1, log = FALSE)
}
\arguments{
\item{x}{A vector giving class memberships of each observation in the sample}

\item{theta}{A non-negative parameter governing the expected sample diversity.}

\item{log}{if TRUE, probabilities are given as log(p). Default is FALSE.}
}
\value{
A numeric vector giving a probability (or if \code{log = TRUE}, a log probability)
}
\description{
Gives the probability mass function for the Ewens distribution, as described in Ewens, Warren (1972). "The sampling theory of selectively neutral alleles". \emph{Theoretical Population Biology}. 3: 87–112. doi:10.1016/0040-5809(72)90035-4.
}
\details{
The probability of a vector of counts \eqn{m_1, ..., m_n} is given by the expression \deqn{\frac{n!}{\theta (\theta + 1) ... (\theta + n - 1)}\prod_{j=1}^n \frac{\theta^{m_j}}{j^{m_j} m_j!}}
}
\examples{
x <- sample(LETTERS, 120, replace = TRUE)
dewens(x, theta = 1)
dewens(x, theta = 0) ## returns NaN since vector incompatible with zero diversity

}
