[R-sig-eco] issue with dbFD function from FD library

Simone Ruzza simone.ruzza12 at gmail.com
Mon Aug 4 16:18:09 CEST 2014


Dear R-users,

apologies for the total beginner's question. I am trying to calculate
three metrics of functional
diversity using the dbFD function from the FD package, but everything
seems to crash, shortly
after I start the analysis. I am using presence and absence data and a
mixture of categorical and continuous traits. I have pasted the error
message which I get from the R console at the bottom of this e-mail,
together with four lines of code and url to files used for the
analysis. I understand that the issue might be with qhull and not the
dbFD function, but I would like to try and understand why things are
not working. A lot of my communities  have few species ( < 3), but not
all of them. I understand that dbFD cannot compute any measures with
communities less than three species, but should the function at least
compute for communities with more than 3 species? Is that because
there are less species (not always) than traits? Any help would be
greatly appreciated!

Best wishes,

Simone


#### code
library(FD)
sp<-read.csv("spdata.csv")
traits<-read.csv("traits.csv",row.names=1)
fd<-dbFD(x=traits,a=sp,corr="sqrt",calc.FDiv=FALSE,calc.FGR=FALSE,calc.CWM=FALSE)

#### dropbox link to files

# species
https://dl.dropboxusercontent.com/u/33966347/spdata.csv
# traits
https://dl.dropboxusercontent.com/u/33966347/traits.csv


### error message

qhull precision warning:
The initial hull is narrow (cosine of min. angle is 1.0000000000000000).
Is the input lower dimensional (e.g., on a plane in 3-d)?  Qhull may
produce a wide facet.  Options 'QbB' (scale to unit box) or 'Qbb' (scale
last coordinate) may remove this warning.  Use 'Pp' to skip this warning.
See 'Limitations' in qh-impre.htm.
QH6114 qhull precision error: initial simplex is not convex. Distance=-4.2e-17

While executing:  | qhull FA Qt
Options selected for Qhull 2012.1 2012/01/26:
  run-id 2058602770  FArea-total  Qtriangulate  _pre-merge  _zero-centrum
  _max-width 0.34  Error-roundoff 2e-16  _one-merge 1e-15  _near-inside 5.1e-15
  Visible-distance 4.1e-16  U-coplanar-distance 4.1e-16  Width-outside 8.2e-16
  _wide-facet 2.5e-15  _narrow-hull  0

precision problems (corrected unless 'Q0' or an error)
      1 flipped facets

The input to qhull appears to be less than 2 dimensional, or a
computation has overflowed.

Qhull could not construct a clearly convex simplex from points:
- p1(v2):   0.1 -0.11
- p0(v1):   0.1 -0.11
- p2(v0): -0.24  0.14

The center point is coplanar with a facet, or a vertex is coplanar
with a neighboring facet.  The maximum round off error for
computing distances is 2e-16.  The center point, facets and distances
to the center point are as follows:

center point -0.01213 -0.02829

facet p0 p2 distance= -2.4e-17
facet p1 p2 distance= -1.7e-17
facet p1 p0 distance= -0.084

These points either have a maximum or minimum x-coordinate, or
they maximize the determinant for k coordinates.  Trial points
are first selected from points that maximize a coordinate.

The min and max coordinates for each dimension are:
  0:   -0.2387    0.1011  difference= 0.3398
  1:   -0.1126    0.1404  difference= 0.253

If the input should be full dimensional, you have several options that
may determine an initial simplex:
  - use 'QJ'  to joggle the input and make it full dimensional
  - use 'QbB' to scale the points to the unit cube
  - use 'QR0' to randomly rotate the input for different maximum points
  - use 'Qs'  to search all points for the initial simplex
  - use 'En'  to specify a maximum roundoff error less than 2e-16.
  - trace execution with 'T3' to see the determinant for each point.

If the input is lower dimensional:
  - use 'QJ' to joggle the input and make it full dimensional
  - use 'Qbk:0Bk:0' to delete coordinate k from the input.  You should
    pick the coordinate with the least range.  The hull will have the
    correct topology.
  - determine the flat containing the points, rotate the points
    into a coordinate plane, and delete the other coordinates.
  - add one or more points to make the input full dimensional.
Error in convhulln(tr.FRic, "FA") : Received error code 2 from qhull.



More information about the R-sig-ecology mailing list