\name{margination}
\alias{labelation}
\alias{nlabelation}
\alias{lnlabelation}
\alias{ldlabelation}
\alias{margination}
\alias{nmargination}
\alias{lnmargination}
\alias{ldmargination}
\title{ Margin combinations }
\description{
  Functions to calculate the number of possible groupings given fixed group sizes (margins).
}
\usage{
nlabelation(...)
lnlabelation(...)
ldlabelation(...)
nmargination(...)
lnmargination(...)
ldmargination(...)
}
\arguments{
  \item{\dots}{ one or more vectors of group sizes }
}
\details{
  Function \code{nmargination} gives the number of possibles groupings (=cluster solutions) that have the input group sizes.
  Function \code{nlabelation} gives the number of possibles assignents to predefined (=labelled) groups of the requires sizes (more possibilities).
  The ln-versions give the log instead, the ld-versions the logarithm dualis.
}
\value{
  scalar
}
\author{ Jens Oehlschlägel }
\seealso{ \code{\link{clusteration}}, \code{\link{permutation}}, \code{\link{combination}}, \code{\link[base]{choose}}, \code{\link[base]{lgamma}}, \code{\link{absolute.entropy}}, \code{\link{exact.margin.info}} }
\examples{
  cat("There are 25 possibilities to make 3 clusters from 5 cases\n")
  nclusteration(5,3)
  cat(" 10 of sizes 3,1,1\n")
  nmargination(3,1,1)
  cat(" and 15 of sizes 2,2,1\n")
  nmargination(2,2,1)
  cat("By contrast there are 30 possibilities to assign 5 cases to 3 labelled groups a=2,b=2,c=1\n")
  nlabelation(2,2,1)
  n <- 250
  k <- 5
  i <- 1:(n/k)
  matplot(k*i, cbind(
      k^(i*k)
    , sapply(i, function(i){nclusteration(k*i, k)})
    , sapply(i, function(i){nmargination(rep(i, k))})
    )
  , log="y", type="l"
  , lty=1:3, xlab="n"
  , ylab = "combinations"
  , main = "number of possible groupings"
  )
  legend(n,1
  , c(substitute(k^n, list(k=k)), expression("no restriction"), expression("equal sizes"))
  , lty=1:3, col=1:3, xjust=1, yjust=0
  )
}
\keyword{ math }
\keyword{ cluster }
