[R-sig-eco] controlling the species displayed on a biplot
Gavin Simpson
gavin.simpson at ucl.ac.uk
Mon May 23 12:33:22 CEST 2011
On Sun, 2011-05-22 at 12:15 +1000, Andrew Halford wrote:
> Hi Dave,
>
> I used the indval function from the package labdsv (your package Dave, I
> believe) and confirmed these results with output from the indicspecies
> package. I want to use all the species to construct the PCA ordination but
> only want to show the species vectors for those 27 species identified as
> significant group discriminators.
>
> Andy
If you really want to do this Canoco-esque type of thing then it is
easy, but you need to build the plot up yourself. Here is an exmaple:
## load packages and example data
require(vegan)
require(labdsv)
data(dune)
data(dune.env)
## Indicators of Management type
set.seed(38)
inds <- with(dune.env, indval(dune, Management))
## ordinate
dune.pca <- rda(dune, scale = TRUE)
## exract scores you want to plot presume species and sites
dune.site <- scores(dune.pca, display = "sites", scaling = 3)
dune.spp <- scores(dune.pca, display = "species",
scaling = 3)[inds$pval <= 0.05, ]
## plot
plot(dune.pca, display = c("sites","species"), type = "n",
scaling = 3)
points(dune.site)
arrows(0, 0, dune.spp[,1], dune.spp[,2], col = "red", length = 0.05)
lab.xloc <- dune.spp[,1] * 1.2
lab.yloc <- dune.spp[,2] * 1.2
text(lab.xloc, lab.yloc, rownames(dune.spp), col = "red", cex = 0.8)
The placement of the labels is crude and can be improved, but not in a
mailing list post.
HTH
G
> On Sun, May 22, 2011 at 1:19 AM, Dave Roberts <
> dvrbts at ecology.msu.montana.edu> wrote:
>
> > On 05/20/2011 11:54 PM, Andrew Halford wrote:
> >
> >> Hi All,
> >>
> >> I have done a IndVal analysis on a dataset which has identified 27 species
> >> out of 57 as being significant arbiters of site differences. What I want
> >> to
> >> do is a PCA biplot (data is hellinger transformed prior to this) with only
> >> these 27 species on the ordination, not all 57, How can I control the
> >> species I want displayed?
> >>
> >> cheers
> >>
> >> Andy
> >>
> >
> > --
> > Andrew,
> >
> > We need a little more information. Which IndVal function did you use?
> > It should return a vector of p-values you can use as a mask [p-val <=
> > 0.05,] on your taxon matrix. But are you saying you want to use all 57 in
> > constructing the PCA and only identify 27, or that you only want to use
> > those 27 in the construction of the PCA?
> >
> > Dave Roberts
> >
> > _______________________________________________
> > R-sig-ecology mailing list
> > R-sig-ecology at r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> >
>
>
>
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-sig-ecology
mailing list