Title: | Hierarchical Partitioning for Canonical Analysis |
---|---|
Description: | This function calculates the independent contribution of each explanatory variable to explained variation (R-squared) on RDA,CCA and db-RDA, applying the hierarchy algorithm of Chevan, A. and Sutherland, M. 1991 Hierarchical Partitioning.The American Statistician, 90-96 <DOI:10.1080/00031305.1991.10475776>. |
Authors: | Jiangshan Lai,Pedro Peres-neto |
Maintainer: | Jiangshan Lai <[email protected]> |
License: | GPL |
Version: | 0.2.0 |
Built: | 2025-02-22 08:54:08 UTC |
Source: | https://github.com/laijiangshan/rdacca.hp |
Internal function for rdacca.hp()
creatbin(col, binmatrix)
creatbin(col, binmatrix)
Internal function for rdacca.hp()
genList(ivlist, value)
genList(ivlist, value)
Internal function for rdacca.hp()
GMI(X, tol = 1e-06)
GMI(X, tol = 1e-06)
Internal function for rdacca.hp()
odd(val)
odd(val)
Permutation Test of Hierarchical Partitioning for Canonical Analysis
permu.hp( dv, iv, method = c("RDA", "dbRDA", "CCA"), type = c("adjR2", "R2"), scale = FALSE, add = FALSE, sqrt.dist = FALSE, n.perm = 1000, permutations = 1000 )
permu.hp( dv, iv, method = c("RDA", "dbRDA", "CCA"), type = c("adjR2", "R2"), scale = FALSE, add = FALSE, sqrt.dist = FALSE, n.perm = 1000, permutations = 1000 )
dv |
Response variable, either a numeric vector or a matrix. If method="dbRDA", dv should be a "dist" matrix. |
iv |
Predictors (explanatory variable), either a data frame or a list of data frames. If it is a data frame, the relative importance of each column of the data frame will be evaluated; if it is a list, the relative importance of each element (matrix) will be evaluated. |
method |
Type of canonical analysis used for variation partitioning, should be a character string, either "RDA", "dbRDA" or "CCA", the default is "RDA". If the response variable (dv) is a numerical vector and method="RDA", the hierarchical and variation partitioning for the classical multiple regression is implemented. |
type |
The type of total explained variation, either "R2" or "adjR2", in which "R2" is unadjusted R-square and "adjR2" is adjusted R-square, the default is "adjR2". The adjusted R-square is calculated using Ezekiel's formula (Ezekiel 1930) for RDA and dbRDA, while permutation procedure is used for CCA (Peres-Neto et al. 2006). |
scale |
Logical; If the columns of dv should be standardized to unit variance when method="RDA" is applied. |
add |
Logical; If a constant should be added to the non-diagonal values to euclidify dissimilarities (see dbrda function in vegan for details). Choice "lingoes" (or TRUE) uses the recommended method of Legendre & Anderson (1999: "method 1") and "cailliez" uses their "method 2". The argument has an effect only when method="dbRDA". |
sqrt.dist |
Logical, If the square root of dissimilarities should be taken. This often euclidifies dissimilarities. The argument has an effect only when method="dbRDA"(see dbrda function in vegan for details). |
n.perm |
An integer; Number of permutations for computing the adjusted R-square for CCA. The argument has an effect only when method="CCA". |
permutations |
An integer; Number of permutations for computing p value of individual contribution for the randomized dataset. |
This function is a permutation test of hierarchical partitioning for canonical analysis. It returns a matrix of I values (the individual contribution towards total explained variation) for all values from permutations randomizations. For each permutation, the values in each variable (i.e each column of iv) are randomized independently, and rdacca.hp is run on the randomized iv. As well as the randomized I matrix, the function returns a summary table listing the observed I values, the p value of I for the randomized dataset.
a data.frame containing a summary table listing the observed individual contribution, the p value of individual contribution for the randomized dataset
Jiangshan Lai [email protected]
library(vegan) data(mite) data(mite.env) #Hellinger-transform the species dataset for RDA mite.hel <- decostand(mite, "hellinger") permu.hp(mite.hel,mite.env,method="RDA",type="adjR2",permutations=10)
library(vegan) data(mite) data(mite.env) #Hellinger-transform the species dataset for RDA mite.hel <- decostand(mite, "hellinger") permu.hp(mite.hel,mite.env,method="RDA",type="adjR2",permutations=10)
plot output of rdacca.hp() based on ggplot2
## S3 method for class 'rdaccahp' plot(outputList, plot.perc = FALSE)
## S3 method for class 'rdaccahp' plot(outputList, plot.perc = FALSE)
outputList |
the output of rdacca.hp(). |
plot.perc |
logical value, if TRUE, the bar plot (based on ggplot2) of the percentage ot independent effects of variables to total Rsquared, the default is FALSE to show plot with original independent effects. |
Jiangshan Lai [email protected]
Pedro Peres-Neto [email protected]
library(vegan) data(mite) data(mite.env) #Hellinger-transform the species dataset for RDA to deal with the "double zero" problem mite.hel <- decostand(mite, "hellinger") rda.hp <- rdacca.hp(mite.hel,mite.env,method="RDA",type="adjR2") plot(rda.hp) plot(rda.hp,plot.perc=TRUE)
library(vegan) data(mite) data(mite.env) #Hellinger-transform the species dataset for RDA to deal with the "double zero" problem mite.hel <- decostand(mite, "hellinger") rda.hp <- rdacca.hp(mite.hel,mite.env,method="RDA",type="adjR2") plot(rda.hp) plot(rda.hp,plot.perc=TRUE)
Hierarchical Partitioning for Canonical Analysis
rdacca.hp( dv, iv, method = c("RDA", "dbRDA", "CCA"), type = c("adjR2", "R2"), trace = FALSE )
rdacca.hp( dv, iv, method = c("RDA", "dbRDA", "CCA"), type = c("adjR2", "R2"), trace = FALSE )
dv |
Response variables. if method="dbRDA", dv is the "dist" matrix. |
iv |
Explanatory variables, typically of environmental variables. |
method |
The type of canonical analysis: RDA, dbRDA or CCA, the default is "RDA". |
type |
The type of total explained variation: "adjR2" is adjusted R-squared and "R2" for unadjusted R-squared, the default is "adjR2". |
trace |
logical value, if TRUE, the vaules of commonality (2^N-1for N explanatory variables) are outputed,the default is FALSE. |
This function calculates the independent contribution of each explanatory variable to explained variation (R-squared) on canonical analysis (RDA,CCA and dbRDA), applying the hierarchy algorithm of Chevan, A. and Sutherland, M. 1991 Hierarchical Partitioning.The American Statistician, 90–96. DOI: 10.1080/00031305.1991.10475776. Under the idea of hierarchy algorithm, the shared R2 can be divided into equal components by number of involved variables, and then allocated equally to these variables as joint effects. The independent contribution of each explanatory variable is the sum of all its allocated common R2 and its unique R2. The order of importance of explanatory variables are determined by their independent contributions.
a list containing
Method_Type |
The type of canonical analysis and the type of total explained variation. |
R.squared |
Total explained variation. |
Commonality |
If trace=TRUE,a mtrix listing tha value and percentage of all commonality (2^N-1 for N explanatory variables). |
Var.part |
A matrix listing independent effect and its percentage to total explained variation for each explanatory variable. |
Jiangshan Lai [email protected]
Pedro Peres-Neto [email protected]
library(vegan) data(mite) data(mite.env) #Hellinger-transform the species dataset for RDA to deal with the "double zero" problem mite.hel <- decostand(mite, "hellinger") rdacca.hp(mite.hel,mite.env,method="RDA",type="adjR2") rdacca.hp(vegdist(mite),mite.env,method="dbRDA",type="adjR2") rdacca.hp(mite,mite.env,method="CCA",type="adjR2")
library(vegan) data(mite) data(mite.env) #Hellinger-transform the species dataset for RDA to deal with the "double zero" problem mite.hel <- decostand(mite, "hellinger") rdacca.hp(mite.hel,mite.env,method="RDA",type="adjR2") rdacca.hp(vegdist(mite),mite.env,method="dbRDA",type="adjR2") rdacca.hp(mite,mite.env,method="CCA",type="adjR2")
Hierarchical Partitioning for Canonical Analysis by Explanatory Matrices
rdacca.mhp( dv, iv, method = c("RDA", "dbRDA", "CCA"), type = c("adjR2", "R2"), trace = FALSE, plot.perc = FALSE )
rdacca.mhp( dv, iv, method = c("RDA", "dbRDA", "CCA"), type = c("adjR2", "R2"), trace = FALSE, plot.perc = FALSE )
dv |
Data frame or matrix containing the response data table or dissimilarity structure inheriting from dist. In community ecology, that table is often a site-by-species table or a dissimilarity object. |
iv |
A list containing N groups explanatory data frame or matrix. |
method |
The type of canonical analysis: RDA, dbRDA or CCA, the default is "RDA". |
type |
The type of total explained variation: "adjR2" is adjusted R-squared and "R2" for unadjusted R-squared, the default is "adjR2". |
trace |
logical value, if TRUE, the vaules of commonality (2^N-1for N group of explanatory variables) are outputed,the default is FALSE. |
plot.perc |
logical value, if TRUE, the bar plot (based on ggplot2) of the percentage to independent effects of variables group to total Rsquared, the default is FALSE to show plot with original independent effects. |
This function calculates the independent contribution of each explanatory group to explained variation (R-squared) on canonical analysis (RDA,CCA and dbRDA), applying the hierarchy algorithm of Chevan and Sutherland (1991). The algorithm is that all joint R-squared will be decomposed into equal fractions by number of involved explanatory groups and average assigned to these group. Independent R-squared of each variable will be the sum of assigned R-squared from joint R-squared and unique R-squared.
a list containing
Method_Type |
The type of canonical analysis and the type of total explained variation. |
R.squared |
The explained variation for global model. |
Commonality |
If trace=TRUE,a mtrix listing tha value and percentage of all commonality (2^N-1 for N explanatory variables groups). |
Var.part |
A matrix listing independent effect and its percentage to total explained variation for each explanatory variable group. |
Jiangshan Lai [email protected]
Pedro Peres-Neto [email protected]
require(vegan) data(mite) data(mite.env) data(mite.xy) data(mite.pcnm) mite.hel <- decostand(mite, "hellinger") iv <- list(env=mite.env,xy=mite.xy,pcnm=mite.pcnm) rdacca.mhp(mite.hel,iv,method="RDA",trace = TRUE,plot.perc = FALSE) rdacca.mhp(vegdist(mite),iv,method="dbRDA",trace = TRUE,plot.perc = FALSE) rdacca.mhp(mite,iv,method="CCA",trace = TRUE,plot.perc = FALSE)
require(vegan) data(mite) data(mite.env) data(mite.xy) data(mite.pcnm) mite.hel <- decostand(mite, "hellinger") iv <- list(env=mite.env,xy=mite.xy,pcnm=mite.pcnm) rdacca.mhp(mite.hel,iv,method="RDA",trace = TRUE,plot.perc = FALSE) rdacca.mhp(vegdist(mite),iv,method="dbRDA",trace = TRUE,plot.perc = FALSE) rdacca.mhp(mite,iv,method="CCA",trace = TRUE,plot.perc = FALSE)