# logkda

##### Etienne's K(D,A)

Calculates Etienne's $K(D,A)$ using a variety of different methods

- Keywords
- math

##### Usage

```
logkda.R(a, use.brob=TRUE)
logkda.a11(a)
logkda.pari(a, numerical=TRUE)
logkda(a, method="pari", ...)
```

##### Arguments

- a
- Count object
- use.brob
- In function
`logkda.R()`

, Boolean, with default`TRUE`

meaning to use Brobdingnagian numbers for the calculation. This is slower but allows one to analyze larger datasets - numerical
- In function
`logkda.pari()`

, Boolean, with default`TRUE`

meaning to return a numerical vector and`FALSE`

meaning to return the string produced by`pari/gp`

- method
- In function
`logkda()`

, a string specifying which method to use. TakesR ,a11 , orpari - ...
- In function
`logkda()`

, further arguments which are passed to the other functions

##### Details

The user should use function `logkda()`

, which is a wrapper for
the other functions. Note that the default method, `pari`

,
requires the pari/gp system to be installed. This is the preferred
option because it is much faster than the other methods.
Functions `logkda.R()`

and `logkda.pari()`

calculate
$K(D,A)$ using the method appearing in Etienne (2005), supplementary
online material; they use `R`

and `pari/gp`

respectively.
Function `logkda.a11`

is a direct implementation of formula A11
in Etienne (2005). The formula is

$$K(D,A)=
\sum_{\left{a_1,\ldots,a_S|\sum a_i=A\right}}
\prod_{i=1}^S\frac{
\overline{s}\left(n_i, a_i\right)
\overline{s}\left(a_i, 1\right) }{
\overline{s}\left(n_i,1\right)}$$
where $\overline{s}\left(n_i,a_i\right)$ are Stirling numbers of
the first kind (see `logS1`

).

##### Note

If `method`

takes its default value of `pari`

`pari/gp`

is not installed (the test is `gp --version`

),
then the method is changed to `R`

and a warning given.
Function `logkda.a11()`

is included because the computational
method is a direct transcription of formula A11; it is very slow.

It would be nice to use `gp2c`

(rather than `gp`

) but I
can't make the `-g`

`gp2c-run`

to make it call `gp`

with the `-q`

flag

##### References

R. S. Etienne 2005. *Ecology Letters*, volume 8, pp253--260.
`doi: 10.111/j.1461-0248.2004.00717.x`

C. Batut and K. Belabas and D. Bernardi and H. Cohen and M. Olivier
2000.

##### See Also

##### Examples

```
a <- count(c(dogs=7,pigs=3,crabs=1,hogs=1,slugs=1))
logkda(a)
logkda.R(a)
logkda.R(a, use.brob=FALSE)
logkda.a11(a)
# All four should be the same up to numerical errors
```

*Documentation reproduced from package untb, version 1.3-3, License: GPL*