% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logseries.R
\name{dlogseries}
\alias{dlogseries}
\alias{logseries}
\alias{plogseries}
\alias{qlogseries}
\alias{rlogseries}
\title{The Logarithmic Series Distribution}
\usage{
dlogseries(x, prob = 0.5, log = FALSE)

plogseries(q, prob = 0.5, lower.tail = TRUE, log.p = FALSE)

qlogseries(p, prob = 0.5, lower.tail = TRUE, log.p = FALSE, max.value = 10000)

rlogseries(n, prob = 0.5)
}
\arguments{
\item{x, q}{vector of quantiles representing the number of events.}

\item{prob}{parameter for the distribution, \verb{0 < prob < 1}}

\item{log, log.p}{logical; if TRUE, probabilities \code{p} are given as \code{log(p)}}

\item{lower.tail}{logical; if TRUE (default), probabilities are \eqn{P[X \le x]}{P[X <= x]}, otherwise, \eqn{P[X > x]}{P[X > x]}.}

\item{p}{vector of probabilities}

\item{max.value}{maximum value returned by \code{qlogseries}}

\item{n}{number of observations for \code{rlogseries}}
}
\value{
\code{dlogseries} gives the density,
\code{plogseries} gives the cumulative distribution function,
\code{qlogseries} gives the quantile function, and
\code{rlogseries} generates random deviates.
}
\description{
The logarithmic series distribution is a long-tailed distribution introduced
by Fisher etal. (1943) in connection with data on the abundance of
individuals classified by species.
}
\details{
These functions provide the density, distribution function, quantile
function and random generation for the logarithmic series distribution with
parameter \code{prob}.

The logarithmic series distribution with \code{prob} = \eqn{p} has density
\deqn{ p ( x ) = \alpha p^x / x } for \eqn{x = 1, 2, \dots},
where
\eqn{\alpha= -1 / \log(1 - p)} and \eqn{0 < p < 1}.
\% Note that counts \code{x==2} cannot occur.
}
\examples{

XL <-expand.grid(x=1:5, p=c(0.33, 0.66, 0.99))
lgs.df <- data.frame(XL, prob=dlogseries(XL[,"x"], XL[,"p"]))
lgs.df$p = factor(lgs.df$p)
str(lgs.df)

require(lattice)
mycol <- palette()[2:4]
xyplot( prob ~ x, data=lgs.df, groups=p,
	xlab=list('Number of events (k)', cex=1.25),
	ylab=list('Probability',  cex=1.25),
	type='b', pch=15:17, lwd=2, cex=1.25, col=mycol,
	key = list(
					title = 'p',
					points = list(pch=15:17, col=mycol, cex=1.25),
					lines = list(lwd=2, col=mycol),
					text = list(levels(lgs.df$p)),
					x=0.9, y=0.98, corner=c(x=1, y=1)
					)
	)


# random numbers
hist(rlogseries(200, prob=.4), xlab='x')
hist(rlogseries(200, prob=.8), xlab='x')



}
\references{
\url{https://en.wikipedia.org/wiki/Logarithmic_distribution}

Fisher, R. A. and Corbet, A. S. and Williams, C. B. (1943). The relation
between the number of species and the number of individuals \emph{Journal of
Animal Ecology}, 12, 42-58.
}
\seealso{
\code{\link[stats]{Distributions}}
}
\author{
Michael Friendly, using original code modified from the
\code{gmlss.dist} package by Mikis Stasinopoulos.
}
\keyword{distribution}
