# logkda

0th

Percentile

##### 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, gp_binary = "gp")
logkda.polyn(a)
logkda(a, method="pari", ...)
logkda_pari_unix(a, numerical, pari_string, gp_binary)
logkda_pari_windows(a, numerical, pari_string)
##### 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

Boolean, with default TRUE meaning to coerce to a numerical vector (thereby losing precision), and FALSE meaning to return the string produced by pari/gp

method

In function logkda(), a string specifying which method to use. Takes “R”, “a11”, or “pari”

pari_string,gp_binary

configuration variables (not intended to be changed by the user)

...

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).

Function logkda.pari() dispatches to either logkda_pari_unix() or logkda_pari_windows() but the windows function is not guaranteed to work.

##### Note

If method takes its default value of “pari”, and 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.

Function logkda.pari() is a wrapper for .logkda.pari.windows() or .logkda.pari.unix(). It uses “if(R.Version()\$os == 'windows')” to check for windows operating systems.

It would be nice to use gp2c (rather than gp) but I can't make the “-g” flag work properly; and I had to hack gp2c-run to make it call gp with the -q flag

##### References

R. S. Etienne 2005. “A New Sampling Formula for Neutral Biodiversity”. 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. “User's guide to PARI/GP”. http://www.parigp-home.de/

etienne,logS1

##### Aliases
• logkda
• logkda.a11
• logkda.R
• logkda.pari
• logkda.polyn
• logkda_pari_unix
• logkda_pari_windows
##### Examples
# NOT RUN {
a <- count(c(dogs=7,pigs=3,crabs=1,hogs=1,slugs=1))

# }
# NOT RUN {
logkda(a)
# }
# NOT RUN {
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.7-4, License: GPL

### Community examples

Looks like there are no examples yet.
{"ft_lang_label":"__label__en","ft_lang_prob":0.65211844,"math_prob":0.82298607,"size":3075,"snap":"2019-51-2020-05","text_gpt3_token_len":953,"char_repetition_ratio":0.11950505,"word_repetition_ratio":0.013667426,"special_character_ratio":0.28390244,"punctuation_ratio":0.17609046,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98739433,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-12-10T16:52:09Z\",\"WARC-Record-ID\":\"<urn:uuid:70da80db-e52f-4eeb-a91c-326cda67a870>\",\"Content-Length\":\"17883\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e57b550d-a9d3-4483-9c1c-2f4b99d38ebc>\",\"WARC-Concurrent-To\":\"<urn:uuid:424ce28e-4d71-4f8b-8915-1ff818869a24>\",\"WARC-IP-Address\":\"52.21.93.115\",\"WARC-Target-URI\":\"https://www.rdocumentation.org/packages/untb/versions/1.7-4/topics/logkda\",\"WARC-Payload-Digest\":\"sha1:FC7VESJTOI7SNOEFVZY5DJJHBYOFO6BW\",\"WARC-Block-Digest\":\"sha1:JMUIUVOHWFK3ZKYCKYCWXIFD5ICWR24Q\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-51/CC-MAIN-2019-51_segments_1575540528457.66_warc_CC-MAIN-20191210152154-20191210180154-00029.warc.gz\"}"}