[R-sig-eco] slope for rarefaction curve

Jari Oksanen jari.oksanen at oulu.fi
Wed May 27 12:02:36 CEST 2015


Just for your information: new version of vegan (2.3-0) is now available on CRAN, and it has function rareslope() that finds the slope of the rarefaction curve at given sample size. It can also calculate the slope at at intermediate non-integer "sample sizes". Together with this, the latest vegan also adds similar slope calculations for analytic species accumulation models ("exact", "rarefaction", "coleman") plus all non-linear regression models in fitspecaccum() (function specslope()).

Cheers, Jari Oksanen 
On 11/05/2015, at 12:09 PM, Jari Oksanen wrote:

> Basic algebrra seems to lead to this function:
> 
> rarederatk <- 
> function (x, k)
> {
>   x <- x[x>0]
>   J <- sum(x)
>   d <- digamma(J-k+1) -digamma(J-x-k+1)
>   g <- lgamma(J-x+1) + lgamma(J-k+1) - lgamma(J-x-k+1)-lgamma(J+1)
>   d <- d*exp(g)
>   sum(d[is.finite(d)])
> }
> 
> Here 'x' must be a vector of species abundances for a single site, and 'k' the sample site at which the 
> derivative is evaluate. Here a simple test that this seems to work (but please check):
> 
> library(vegan)
> data(mite)
> rarecurve(mite[1,]) # first sampling point
> sum(rarecurve(mite[1,]) # 140, evaluate at 126 individuals
> y <- rarefy(mite[1,], 126) # 19.47011
> b <- rarederatk(mite[1,], 126) # derivetive 0.04032 (with warnings)
> abline(y-126*b, b) # matches the rarecurve plot
> 
> Cheers, Jari Oksanen
> ________________________________________
> From: R-sig-ecology <r-sig-ecology-bounces at r-project.org> on behalf of Zoltan Botta-Dukat <botta-dukat.zoltan at okologia.mta.hu>
> Sent: 11 May 2015 08:49
> To: r-sig-ecology at r-project.org
> Subject: Re: [R-sig-eco] slope for rarefaction curve
> 
> Dear Simone,
> 
> Function "rarefy" uses the function developed by Hurlbert, thus if you
> need slope in a certain point (as your graph suggests) you can calculate
> the derivative of this function. It is not an easy job, because
> factorials should be derived. See cues here how it can be done:
> 
> http://math.stackexchange.com/questions/300526/derivative-of-a-factorial
> 
> If you need mean slope in an interval, simply calculate the difference
> in the calculated values for the beginning and end of the interval, and
> divide the difference by the length of the interval.
> 
> Zoltan
> 
> 2015.05.10. 23:57 keltezéssel, Simone Ruzza írta:
>> Dear all,
>> 
>> apologies for the total beginner's question. I was wondering if anyone
>> can give some advice on how to calculate the slope for the last 10% of
>> the records of a rarefaction curve computed with rarefy from vegan.
>> Here is a graphic representation of what I would like to do:
>> 
>> https://dl.dropboxusercontent.com/u/33966347/figure.JPG
>> 
>> I have seen that this has been done in a recent paper and I was
>> wondering if anyone may have any code snippet to do that. Sorry, maybe
>> this is something really obvious but I have not quite understood how
>> to do it.
>> 
>> thanks!
>> 
>> Simone
>> 
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> 
> 
> --
> Botta-Dukát Zoltán
> --------------------------------
> Ökológiai és Botanikai Intézet
> Magyar Tudományos Akadémia
> Ökológiai Kutatóközpont
> --------------------------------
> 2163. Vácrátót, Alkotmány u. 2-4.
> tel: +36 28 360122/157
> fax: +36 28 360110
> botta-dukat.zoltan at okologia.mta.hu
> www.okologia.mta.hu
> 
> 
> Zoltán BOTTA-Dukát
> --------------------------------
> Institute of Ecology and Botany
> Hungarian Academy of Sciences
> Centre for Ecological Research
> --------------------------------
> H-2163 Vácrátót, Alkomány u. 2-4.
> HUNGARY
> Phone: +36 28 360122/157
> Fax..: +36 28 360110
> botta-dukat.zoltan at okologia.mta.hu
> www.okologia.mta.hu
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



More information about the R-sig-ecology mailing list