AndrewLJackson / SIBER

ellipse and convex hull fitting package for stable isotope data
36 stars 14 forks source link

Trying SIBER with NMDS #95

Open AylenM opened 1 year ago

AylenM commented 1 year ago

Hi! I have seen some works using NMDS x and y values of individuals to apply in SIBER (Fatty acids research). I have tried this but some things appear to be incorrect. (My data has two groups and only one community).

SEA.B.credibles <- lapply( as.data.frame(SEA.B), function(x,...){tmp<-hdrcde::hdr(x)$hdr}, prob = cr.p) SEA.B.credibles

$V1

[,1] [,2]

99% 0.005803027 0.03913901

95% 0.006894371 0.03013240

50% 0.010240394 0.01700947

$V2

[,1] [,2] [,3] [,4]

99% 0.005898435 0.02601642 0.02654745 0.02808042

95% 0.006891047 0.02259675 NA NA

50% 0.009724435 0.01449590 NA NA

My SEA.B is a list of two, I don´t understand why V2 has 4 columns and V1 only 2.

And: bayes95.overlap1_2 <- bayesianOverlap(ellipse1, ellipse2, ellipses.posterior, draws = 100, p.interval = 0.95, n = 100) overlap.credibles1_2 <- lapply( as.data.frame(bayes95.overlap1_2), function(x,...){tmp<-hdrcde::hdr(x)$hdr}, prob = cr.p)

bayes95.overlap1_2 has Area 1, Area 2 and overlap And I have obtained:

Error in KernSmooth::bkfe(gcounts, 6, alpha, range.x = c(a, b), binned = TRUE) : 'bandwidth' must be strictly positive

Is it possible to solve these problems? Is the NMDS/SIBER application correct?

Thank you so much in advance!

benjaminhlina commented 2 months ago

It's hard to answer your question as you have not provided a reproducible example (reprex; click reprex to see examples) Please provide a reprex.

AndrewLJackson commented 2 months ago

Hi. It looks to me like that your V2 ellipse has a bimodal distribution such that there are two credible intervals for each the 99% credible Intervals. This can happen if your data truly are bimodal or if your sample size is too small and it’s an artefact. I suggest you increase number of iterations and if it persists then you may beed to asks whether the underlying data really do suggest bodality or if there is an argument that there are more than one groups within this population