Skip to content

Help PCNM analysis

4 messages · Jari Oksanen, Emma EG. Gothe, François Gillet

#
Dear list members!

I am trying to perform a PCNM analysis with function PCNM() (binary package provided by the provided by project Spatial ecological data analysis with R). I recently ran into a problem. I have a triangular distance matrix based on the shortest distance between my sampling points which I am using in the PCNM function instead of geographic coordinates. When I tried to perform the analysis on this distance matrix I got an error message (see below) that says I have "empty neighbor sites". I have used the same code and the exactly same type of distance matrices before and I did not have any problem. I have also searched my distance matrix for ev. missing values/other obvious errors and tried to search for a solution online but without any luck.

The file "Eucl stream order1.txt" is attached and my code is:
Truncation level = 1092.48
Error in as.matrix(listw2sn(nb2listw(nb))[, 1:2]) :
  error in evaluating the argument 'x' in selecting a method for function 'as.matrix': Error in nb2listw(nb) : Empty neighbour sets found
Timing stopped at: 0.01 0 0.02

If anyone could help me to figure this out, and have suggestions for a solution I would be very greatful!

Best Emma

_______________________________________

Emma G?the, PhD-student
Department of Aquatic Sciences and Assessment
Swedish University of Agricultural Sciences
Box 7050
750 07 Uppsala

Tel: +46-(0)18-673138
Fax: +46-(0)18-673156
OBS! New E-mail: emma.gothe at slu.se<mailto:emma.gothe at slu.se>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Eucl stream order1.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20111005/b33c7679/attachment.txt>
#
On Wed, 2011-10-05 at 10:25 +0200, Emma Gothe wrote:
Emma,

I don't know about the PCNM package, but the matrix goes smoothly true
vegan::pcnm:
Loading required package: permute
This is vegan 2.0-0
List of 4
 $ vectors  : num [1:30, 1:19] -0.2245 -0.2239 -0.2249 -0.2907
-0.0212 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:30] "A2" "A3" "A4" "A5" ...
  .. ..$ : chr [1:19] "PCNM1" "PCNM2" "PCNM3" "PCNM4" ...
 $ values   : num [1:29] 71640230 66080002 58129580 29179643
16447538 ...
 $ weights  : num [1:30] 1 1 1 1 1 1 1 1 1 1 ...
 $ threshold: num 1092
 - attr(*, "class")= chr "pcnm"

Cheers, Jari Oksanen
#
Thank you Jari for a fast reply!

I will try the vegan function asap as it seems to work smoothly. I am still wondering what causes the problem in the PCNM () function though... If anyone else knows, then please let me know. 

Best Emma 

-----Ursprungligt meddelande-----
Fr?n: Jari Oksanen [mailto:jari.oksanen at oulu.fi] 
Skickat: den 5 oktober 2011 12:46
Till: Emma Gothe
Kopia: r-sig-ecology at r-project.org
?mne: Re: [R-sig-eco] Help PCNM analysis
On Wed, 2011-10-05 at 10:25 +0200, Emma Gothe wrote:
Emma,

I don't know about the PCNM package, but the matrix goes smoothly true
vegan::pcnm:
Loading required package: permute
This is vegan 2.0-0
List of 4
 $ vectors  : num [1:30, 1:19] -0.2245 -0.2239 -0.2249 -0.2907
-0.0212 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:30] "A2" "A3" "A4" "A5" ...
  .. ..$ : chr [1:19] "PCNM1" "PCNM2" "PCNM3" "PCNM4" ...
 $ values   : num [1:29] 71640230 66080002 58129580 29179643
16447538 ...
 $ weights  : num [1:30] 1 1 1 1 1 1 1 1 1 1 ...
 $ threshold: num 1092
 - attr(*, "class")= chr "pcnm"

Cheers, Jari Oksanen