Re: [R-sig-eco] slope for rarefaction curve

2015-05-27 Thread Jari Oksanen
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[x0]
   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-boun...@r-project.org on behalf of Zoltan 
 Botta-Dukat botta-dukat.zol...@okologia.mta.hu
 Sent: 11 May 2015 08:49
 To: r-sig-ecology@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@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.zol...@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.zol...@okologia.mta.hu
 www.okologia.mta.hu
 
 ___
 R-sig-ecology mailing list
 R-sig-ecology@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
 
 ___
 R-sig-ecology mailing list
 R-sig-ecology@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] adehabitatLT null models question

2015-05-27 Thread A.P.B. Carneiro

Dear list,

I am using the package adehabitatLT to create null models using the 
function bellow. I set my treatment function to NULL and I included a 
constraint function based on an MCP of all my animal locations.


my.CRW - NMs.randomCRW(na.omit(inter3), rangles = TRUE, rdist = TRUE, 
fixedStart = TRUE,

x0 = NULL, rx = NULL, ry = NULL, treatment.func = NULL,
treatment.par = NULL, constraint.func = consfun,
constraint.par = GHA_const, nrep = 15)

my.sim- testNM(my.CRW)

When I was ordering the data by dates to extract my environmental 
variables, I realised that no matter the number of nrep I perform, my 
results (locations of the null model) for a specific date are all the 
same. I don’t think this is right, correct? The idea of generating the 
crw is to have a possible distribution where the animal could have gone. 
Although the results are different than the original coordinates, 
instead of generating 15 different trajectories it is just generating 
one. Here an example of my output:


x   y   dateId  CRW_Id
1   4775351 1059107 13/05/2003 20:27 O66A   1
50  4775351 1059107 13/05/2003 20:27 O66A   2
99  4775351 1059107 13/05/2003 20:27 O66A   3
148 4775351 1059107 13/05/2003 20:27 O66A   4
197 4775351 1059107 13/05/2003 20:27 O66A   5
246 4775351 1059107 13/05/2003 20:27 O66A   6
295 4775351 1059107 13/05/2003 20:27 O66A   7
344 4775351 1059107 13/05/2003 20:27 O66A   8
393 4775351 1059107 13/05/2003 20:27 O66A   9
442 4775351 1059107 13/05/2003 20:27 O66A   10


Could you help me undertand that? Any possible solution?

Thanks a lot for your help!

Best,

Ana


--

PhD student

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology