JohnsonHsieh / iNEXT

R package for interpolation and extrapolation
https://JohnsonHsieh.github.com/iNEXT
57 stars 26 forks source link

Error when attempting to use iNext for abundance data #8

Closed dsetaro closed 8 years ago

dsetaro commented 8 years ago

Hello, I am a graduate student at Arizona State University majoring in Plant Biology and Conservation. I am attempting to use iNext to answer some of my thesis research questions about diversity for plant assemblages in my experiment.

I am using R version 3.2.3 and RStudio version 0.99.893. I am new to R so I don't have much experience with programming or debugging code. I used RStudio to import my data set (a .csv file) iNext.SpecbyPooledID.csv.zip and then used the following code to try to run the iNext command:

results<-iNEXT(iNext.SpecbyPooledID, q=c(0,1,2), datatype = "abundance", size = NULL, endpoint = NULL, knots = 30, se = TRUE, conf = 0.95, nboot = 50)

I am receiving the following error after running the above command with the provided data file:

Error in rmultinom(nboot, n, Prob.hat) : no positive probabilities

Can you please tell me what is causing this error and what steps I need to do to fix it? I would greatly appreciate any help that you can provide because this a major analysis that I need in order to complete my thesis.

KaushikNarasimhan commented 8 years ago

I am having the exact same issue. Have you made any progress on this?

JohnsonHsieh commented 8 years ago

Hi dsetaro and KaushikNarasimhan

I have solved this issue. The problem happened when there is only one species in a site. In this case, we have no information to build a robust bootstrap site to compute estimator and its variance.

For this case, I give a exception handling condition (warning message in computing function):

> # The BGW.R.W site has only one species
> iNEXT(iNext.SpecbyPooledID[["BGW.R.W"]] )
Warning messages:
1: In EstiBootComm.Ind(Spec) :
  This site has only one species. Estimation is not robust.
2: In BootstrapFun.abun(x = x, FunName, datatype, B) :
  This site has only one species. Estimation is not robust.
3: In BootstrapFun.abun(x = x, FunName, datatype, B) :
  This site has only one species. Estimation is not robust.

Please upgrade last version of iNEXT package from github devtools::install_github("JohnsonHiseh/iNEXT")