Skip to content

Commit

Permalink
\deqn included in man pages fo distribution functions
Browse files Browse the repository at this point in the history
  • Loading branch information
piklprado committed Mar 29, 2015
1 parent 98e8e5f commit 10d6339
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions man/dbs.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ qrbs( p, N, S, lower.tail = TRUE, log.p = FALSE )
The Broken-stick distribution was proposed as a model for
the expected abundance of elements in a collection:
n(i) = N/S (sum(from k=i to S) 1/k)
\deqn{n(i) = \frac{N}{S} \sum_{k=i}^S 1/k}{n(i) = N/S (sum(from k=i to S) 1/k)}
where n(i) is the abundance in the i-th most abundant element
(MacArthur 1960, May 1975).
Hence the probability (or expected proportion of occurrences)
in the i-th element is
p(i) = n(i)/N = n(i) = (sum(from k=i to S) 1/k) / S
\deqn{p(i) = \frac{n(i)}{S} = S^{-1}\sum_{k=i}^S 1/k}{p(i) = n(i)/N = (sum(from k=i to S) 1/k) / S}
\code{[dpq]rbs} stands for "rank-abundance Broken-stick" and return
probabilities and quantiles based on the expression above, for p(i).
Expand All @@ -78,7 +78,7 @@ qrbs( p, N, S, lower.tail = TRUE, log.p = FALSE )
The probability density for a given abundance value in the Broken-stick model
is given by

p(x) = (1 - x/N)^(S-2) (S - 1)/N
\deqn{p(x) = \frac{S-1}{N} \left( 1 - \frac{x}{N} \right)^{S-2}}{p(x) = (1 - x/N)^(S-2) (S - 1)/N}

Where x is the abundance of a given element in the collection (May 1975).
\code{[dpq]bs} return probabilities and quantiles according to the
Expand Down
4 changes: 2 additions & 2 deletions man/dgs.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ qgs( p, k, S, lower.tail = TRUE, log.p = FALSE )
proportion of occurrences) of the i-th most abundant element
in a collection:

p(i) = C * k * (1-k)^(i-1)
\deqn{p(i) = C k (1-k)^{i-1}}{p(i) = C * k * (1-k)^(i-1)}

where C is a normalization constant which makes the summation of p(i) over
S equals to one:

C = 1/(1 - (1-k)^S)
\deqn{C = \frac{1}{1 - (1-k)^S}}{C = 1/(1 - (1-k)^S)}

where S is the number of species in the sample.

Expand Down
10 changes: 5 additions & 5 deletions man/dls.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ qls(p, N, alpha, lower.tail = TRUE, log.p = FALSE)
was originally proposed by Fisher (1943) to relate the expected number
of species in a sample from a biological community to the sample size as:
S = alpha * log(1 + N/alpha)
% \deqn{S = \alpha \log \left( 1 + \frac{N}{\alpha} \right)}{S = alpha * log(1 + N/alpha)}
Where alpha is the single parameter of the log-series distribution,
often used as a diversity index. From this relation follows that the
expected number of species with x individuals in the sample is
S(x) = alpha*X^x/x
\deqn{S(x) = \alpha \, \frac{X^x}{x}}{S(x) = alpha*X^x/x}
Where X is a function of alpha and N, that tends to one as the sample
size N increases:
X = N / (alpha+ N)
\deqn{X = \frac{N}{\alpha + N}}{X = N / (alpha+ N)}
The density function used here is derived by Alonso et al. (2008,
supplementary material). In ecology, this density distribution gives
Expand All @@ -67,7 +67,7 @@ qls(p, N, alpha, lower.tail = TRUE, log.p = FALSE)
random variables that follow a log-series distribution. Thus, a random
sample of a log-series is also a log-series distribution.
Hence, a log-series distribution is a model for species
Therefore, a log-series distribution is a model for species
abundances distributions (SAD) under the assumptions that (a) species
abundances in the community are independent identically distributed
log-series variables, (b) sampling is a Poisson process, (c)
Expand Down Expand Up @@ -126,4 +126,4 @@ all.equal(pls(10,N=1000,alpha=50), sum(dls(1:10,N=1000,alpha=50))) # should be T
## qls is the inverse of pls
all.equal(qls(CDF,N=100,alpha=5), x) # should be TRUE
}
}
2 changes: 1 addition & 1 deletion man/dman.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ qmand( p, N, s, v, lower.tail = TRUE, log.p = FALSE)
of a given element from a set of \code{N} elements. This probability is inversely proportional to a power \code{s} of the
rank of the frequency of the element in the set. The density function is

p(x) = ((x+v)^(-s)) / sum(((1:N)+v)^(-s))
\deqn{p(x) = \frac{(x+v)^{-s}}{\sum_{i=1}^N (i+v)^{-s}}}{p(x) = ((x+v)^(-s)) / sum(((1:N)+v)^(-s))}

Since p(x) is proportional to a power of \code{x}, the Zipf-Mandelbrodt distribution is a
power distribution. The Zipf distribution is a special case when
Expand Down
4 changes: 2 additions & 2 deletions man/dmzsm.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ pmzsm(q, J, theta, lower.tail=TRUE, log.p=FALSE)
Alonso and McKane (2004) proposed an approximation for the density
function for a large Poisson sample (J>100):

p(x) = N(x)/(sum(from 1 to S) N(x))
\deqn{p(x) = \frac{N(x)}{\sum_1^S N(x)}}{p(x) = N(x)/(sum(from 1 to S) N(x))}

where S is the number of populations in the sample, and
N(x) is the expected number of sampled populations of size x :

N(x) = theta/x (1 - x/J)^(theta -1)
\deqn{N(x) = \frac{\theta}{x (1 - x/J)^{\theta -1}}}{N(x) = theta/x (1 - x/J)^(theta -1)}

Therefore, the mZSM
is a model for species
Expand Down
8 changes: 3 additions & 5 deletions man/dpareto.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ values \code{NaN}, with a warning.
\details{
The Pareto distribution is a continuous power-law density distribution
with \code{scale} and \code{shape} parameters with the form:
with \code{scale} (a) and \code{shape} (b) parameters with the form:
f(x) = shape * scale^shape / x^(shape+1)
\deqn{f(x) = \frac{b a^b} {x^{b+1}}}{f(x) = shape * scale^shape / x^(shape+1)}
For all x >= scale, and
f(x) = 0
otherwise.
f(x) = 0 otherwise.
The shape parameter is known as Pareto's index or tail index, and
increases the decay of f(x). This distribution was originally used to
Expand Down
8 changes: 5 additions & 3 deletions man/dpoilog.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ qpoilog( p, mu, sig, S = 30, lower.tail = TRUE, log.p = FALSE)
where its single parameter lambda is a random variable with lognormal distribution.
The density function is

p(x) = (exp(x*mu + x^2*sig/2)*(2*pi*sig)^(-1/2))/x! * g(y)
\deqn{p(x) = \frac{e^{x \mu + x^2 \sigma/2} (2 \pi \sigma)^{-1/2}}{x!}
\, g(y)}{p(x) = (exp(x*mu + x^2*sig/2)*(2*pi*sig)^(-1/2))/x! * g(y)}

where g(y) =
int_-infty^infty exp(-exp(y))*exp(((-y-mu-x*sig)^2)/(2*sig)) dy
where
\deqn{g(y) = \int_{-\infty}^\infty \, e^{-e^y} \frac{e^{(-y-\mu-x
\sigma)^2}}{2 \sigma} \, dy}{g(y) = int_-infty^infty exp(-exp(y))*exp(((-y-mu-x*sig)^2)/(2*sig)) dy}

(Bulmer 1974 eq.5). For x = 0, 1, 2, ... .

Expand Down
4 changes: 2 additions & 2 deletions man/dpoix.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ dpoix(x, frac, rate, log=FALSE)
\details{
A compound Poisson-exponential distribution is a Poisson probability distribution
where its single parameter lambda, is frac*n, at which n
is a random variable with exponential distribution. Thus, the expected value and variance are E[X] =
Var[X] = frac*n . The density function is
is a random variable with exponential distribution. Thus, the expected
value and variance are E[X] = Var[X] = frac*n . The density function is

p(y) = rate*frac^y / (frac + rate)^(y+1)

Expand Down
4 changes: 2 additions & 2 deletions man/dpower.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ qpower( p, s, lower.tail= TRUE, log.p=FALSE)
The power density is a discrete probability distribution defined for
integer x > 0:

p(x) = x^(-s) / zeta (s)
\deqn{p(x) = \frac{x^{-s}}{\zeta (s)}}{p(x) = x^(-s) / zeta (s)}

Hence p(x) is proportional to a
negative power of 'x', given by the 's' exponent. The Riemann's zeta
negative power of 'x', given by the 's' exponent. The Riemann's \eqn{\zeta}{zeta}
function is the integration constant.
The power distribution can be used as a species abundance distribution (sad) model, which
Expand Down
2 changes: 1 addition & 1 deletion man/dzipf.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ qzipf( p, N, s, lower.tail = TRUE, log.p = FALSE)
law, this probability is inversely proportional to a power \code{s} of the frequency
rank of the element in the set. The density function is

p(x) = (x^(-s)) / sum((1:N)^(-s))
\deqn{p(x) = \frac{x^{-s}}{\sum_{i=1}^N i^{-s}}}{p(x) = ((x+v)^(-s)) / sum(((1:N)+v)^(-s))}

Since p(x) is proportional to a power of \code{x}, the Zipf distribution is a
power distribution. The Zeta distribution is a special case at the limit
Expand Down
2 changes: 1 addition & 1 deletion man/trueLL.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
\alias{trueLL,fitsad,ANY,missing,missing,numeric-method}
\alias{trueLL,numeric,character,list,ANY,numeric-method}

\title{True likelihood for continuous variables}}
\title{True likelihood for continuous variables}

\description{
Calculates the correct likelihood for independent observations of a
Expand Down
2 changes: 1 addition & 1 deletion vignettes/sads_intro.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
\newcommand{\R}{{\sf R}}
\newcommand{\code}[1]{\texttt{#1}}
\SweaveOpts{eval=TRUE, keep.source=TRUE, echo=TRUE}
\VignetteIndexEntry{Introduction to sads}
%\VignetteIndexEntry{Introduction to sads}

\begin{document}

Expand Down

0 comments on commit 10d6339

Please sign in to comment.