Last data update: 2014.03.03

R: Association between phylogeny-weighted species composition...
matrix.p.sigR Documentation

Association between phylogeny-weighted species composition and environmental predictors

Description

Analyses to relate an environmental gradient to the phylogenetic assembly of species across a metacommunity by means of phylogenetic fuzzy weighting.

Usage

matrix.p.sig(comm, dist.spp, envir, analysis = c("adonis", "mantel"),
  method = "bray", squareroot = TRUE, method.envir = "euclidean",
  runs = 999)

pcps.sig(comm, dist.spp, envir, analysis = c("glm", "rda"), method = "bray",
  squareroot = TRUE, formula, family = gaussian, AsFactors = NULL,
  pcps.choices = c(1, 2, 3, 4), runs = 999)

Arguments

comm

Community data, with species as columns and sampling units as rows. This matrix can contain either presence/absence or abundance data.

dist.spp

Matrix containing phylogenetic distances between species.

envir

Environmental variables for each community, with variables as columns and sampling units as rows.

analysis

Type of analysis. For the function pcps.sig glm or rda, for matrix.p.sig function adonis or mantel. See Details.

method

Dissimilarity index, as accepted by vegdist (Default dist = "bray").

squareroot

Logical argument (TRUE or FALSE) to specify if use square root of dissimilarity index (Default squareroot = TRUE).

method.envir

Resemblance index between communities based on environmental variables, as accepted by vegdist used in Mantel analysis (Default method.envir = "euclidean")

runs

Number of permutations for assessing significance.

formula

An object of class formula quotation marks used in GLM analysis. See Details.

family

A description of the error distribution to be used in used in GLM analysis. See family (Dafault family = gaussian).

AsFactors

Encode an environmental variable as factor used in GLM analysis. See Details.

pcps.choices

PCPS used in RDA analysis (Default pcps.choices = c(1, 2, 3, 4)).

Details

Each metacommunity is submitted to phylogenetic fuzzy weighting, generating a matrix that describing the phylogeny-weighted species composition of the communities (matrix.p). The function matrix.p.sig test directly the association this matrix with the environmental predictors. The pairwise dissimilarities are submitted to Mantel test (mantel) or ADONIS test (adonis) to evaluate the influence of an environmental gradient on species dispersion across the communities. The function pcps.sig generates principal coordinates of phylogenetic structure (pcps) and use a single axis for run a generalized linear model (GLM, glm) or use set of axis for run a distance-based redundancy analysis (db-RDA, rda).

The significance is obtained via two null models, one that shuffles sites across the environmental gradient and another that shuffles terminal tips (taxa) across the phylogenetic tree. The first null model (site shuffle) shuffles the site position across the environmental gradient and rerun the same model, generating a null F value (or r value in Mantel test). The second null model (taxa shuffle), shuffles terminal tips across the phylogenetic tree and generates a null matrix containing phylogeny-weighted species composition and rerun the same model, generating another null F value. In the pcps.sig function are generate set of null PCPS and each null PCPS (or set of PCPS in RDA) is submitted to a procrustean adjustment (see procrustes), and the fitted values between observed PCPS and null PCPS is obtained. The adjusted null PCPS is used to rerun the model, generating another null F value. The observed F value (or r value) is compared independently with both null sets of F values (or r value) to generate a probability value of the original F value being generated merely by chance according to each null model.

The item formula is an expression of the form pcps.1 ~ model. The response term must be the pcps name, for example pcps.1, pcps.2, pcps.12.

The item AsFactors changes a environmental variable for the class factor. The sequence is the same that in the environmental data matrix. Use c to combine more that one variable.

Value

model

The model, an object of class glm, rda, adonis or mantel.

Envir_class

The class of each variable in environmental data in glm.

formula

The formula used in glm.

statistic.obs

Observed F value or r value.

p.site.shuffle

The p value for the site shuffle null model.

p.taxa.shuffle

The p value for the taxa shuffle null model.

Author(s)

Vanderlei Julio Debastiani <vanderleidebastiani@yahoo.com.br>

References

Duarte, L.S. (2011). Phylogenetic habitat filtering influences forest nucleation in grasslands. Oikos, 120, 208:215.

See Also

matrix.p, pcps, procrustes, glm, rda, adonis, mantel

Examples


data(flona)
pcps.sig(flona$community, flona$phylo, flona$environment, analysis = "glm",
        formula = "pcps.1~alt", runs = 99)
matrix.p.sig(flona$community,flona$phylo,flona$environment[,2],
        analysis = "adonis", runs=99)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PCPS)
Loading required package: SYNCSA
Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.4-0
Loading required package: mice
Loading required package: Rcpp
mice 2.25 2015-11-09
Loading required package: FD
Loading required package: ade4

Attaching package: 'ade4'

The following object is masked from 'package:vegan':

    cca

Loading required package: ape
Loading required package: geometry
Loading required package: magic
Loading required package: abind
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PCPS/pcps.sig.Rd_%03d_medium.png", width=480, height=480)
> ### Name: matrix.p.sig
> ### Title: Association between phylogeny-weighted species composition and
> ###   environmental predictors
> ### Aliases: matrix.p.sig pcps.sig
> ### Keywords: PCPS
> 
> ### ** Examples
> 
> 
> data(flona)
> pcps.sig(flona$community, flona$phylo, flona$environment, analysis = "glm",
+         formula = "pcps.1~alt", runs = 99)
$model

Call:  glm(formula = formula, family = family, data = data_obs)

Coefficients:
(Intercept)          alt  
 -3.718e-03    6.471e-05  

Degrees of Freedom: 38 Total (i.e. Null);  37 Residual
Null Deviance:	    0.5609 
Residual Deviance: 0.5608 	AIC: -48.76

$Envir_class
     Class    
alt  "numeric"
temp "numeric"
plu  "numeric"

$formula
[1] "pcps.1~alt"

$statistic.obs
     value 
0.00106638 

$p.site.shuffle
[1] 0.99

$p.taxa.shuffle
[1] 1

> matrix.p.sig(flona$community,flona$phylo,flona$environment[,2],
+         analysis = "adonis", runs=99)
$model

Call:
vegan::adonis(formula = p.dist ~ envir, permutations = runs) 

Permutation: free
Number of permutations: 99

Terms added sequentially (first to last)

          Df SumsOfSqs  MeanSqs F.Model      R2 Pr(>F)  
envir      1   0.09915 0.099155  1.7522 0.04521   0.09 .
Residuals 37   2.09385 0.056590         0.95479         
Total     38   2.19300                  1.00000         
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$statistic.obs
[1] 1.752151

$p.site.shuffle
[1] 0.09

$p.taxa.shuffle
[1] 0.02

> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>