[R] ordisurf (pkg vegan) gives implausible result
Joris Meys
jorismeys at gmail.com
Wed Jun 9 12:15:23 CEST 2010
Ordisurf uses a gam model to fit the surface (and more exactly, in
your case a thin plate regression spline). Standard these ts splines
try to reduce the dimensionality of your model as much as possible.
Hence in your case they fit indeed a linear plane through the space,
which is supposed to be the best fit. If you want an exact fit of your
data, you shouldn't use a model.
To see what goes on, you can try following right after the ordisurf command :
lK <- cut2(K,g=5,onlycuts=T)
gen <- (K-min(K)+0.1)/(max(K)+0.2-min(K))
leg <- (lK-min(K)+0.1)/(max(K)+0.2-min(K))
colgen <- rgb(0,gen,0)
points(sample.mds$points, pch=19,col=colgen)
colleg <- rgb(0,leg,0)
legend("topleft",legend=lK,col=colleg,horiz=T,pch=19)
This plots the values in color coding, so you can try to judge the
fit. Also look at the object from ordisurf itself:
ordi.object <- ordisurf(sample.mds, edaphic$K, xlab="PC 1", ylab="PC
2", main="K")
str(ordi.object)
This should contain the information on the gam fit.
Cheers
Joris
On Wed, Jun 9, 2010 at 5:33 AM, Matt Bakker <matt.g.bakker at gmail.com> wrote:
> I'm having trouble with the ordisurf function in the vegan package.
>
> I have created an ordination plot (cmdscale) of 60 samples based on
> Bray-Curtis dissimilarities, and would like to overlay various soil edaphic
> characteristics as possible clues to the clustering I observe in my plot.
> However, I find that ordisurf creates a surface on the plot that is a
> perfect, even gradient - and doesn't match my data. An example of this
> output is attached (as .ps file), while these are the data for the
> environmental variable of interest:
>
>> edaphic$K
> [1] 28 61 48 29 28 26 45 28 34 33 55 62 44 51 60 68 51 31 54 32 58 50 37 35
> 35 34 52 29 53 24 37 50 62 51
> [35] 28 39 47 41 49 83 33 50 55 71 59 50 57 47 46 49 43 30 56 23 49 35 31 27
> 38 52
>
> The contour lines suggest that there are only two values below 32, when in
> fact there are 11.
> Any ideas? Thanks!
>
>>>>
>> bc <- read.table("braycurtis_noheader.dist",header=F)
>> sample.mds <- cmdscale(bc)
>> edaphic <- read.table("edaphic.txt", header=T)
>> library(vegan)
> This is vegan 1.17-2
>> ordisurf(sample.mds, edaphic$K, xlab="PC 1", ylab="PC 2", main="K")
> Loading required package: mgcv
> This is mgcv 1.6-1. For overview type `help("mgcv-package")'.
> Family: gaussian
> Link function: identity
> Formula:
> y ~ s(x1, x2, k = knots)
> Estimated degrees of freedom:
> 2 total = 3
> GCV score: 140.9051
>
> --
> Matthew Bakker
> Ph.D. Candidate
> Department of Plant Pathology
> University of Minnesota
> 495 Borlaug Hall
> 1991 Upper Buford Circle
> Saint Paul, MN 55108 USA
>
> 612-624-2253
> matt.g.bakker at gmail.com
> http://plpa.cfans.umn.edu/Matt_Bakker.html
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
Joris Meys
Statistical consultant
Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control
tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
More information about the R-help
mailing list