% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rewens.R
\name{rewens}
\alias{rewens}
\title{Draw from the Ewens distribution}
\usage{
rewens(n, theta = 1)
}
\arguments{
\item{n}{The sample size.}

\item{theta}{A non-negative parameter governing the expected sample diversity.}
}
\value{
A vector of length n consisting of numeric class labels.
}
\description{
Returns a vector with class membership
}
\details{
Although this command is described as sampling from the Ewens distribution, it is easier to think of it as a particular instantiation of the Chinese Restaurant Process, run for n "customers". The $j$th customer
\itemize{
\item sits at a new table with probability \eqn{\frac{\theta}{j - 1 + \theta}}, or
\item sits at an occupied table with probability \eqn{\frac{c}{j - 1 + \theta}}
where $c$ is the number of customers already at each table.
}
}
\examples{
rewens(100, 1)
rewens(120, 0.5)
rewens(10, 0) ## equal to rep(1, 10)
}
