en:customized_functions:p.adjust.envfit
p.adjust.envfit
Author: David Zelený
Function used to adjust the p-values in results of envfit
function (from vegan
) for the multiple test problem (by default using Bonferroni's correction).
The definition of the function can be sourced from here:
source ('https://raw.githubusercontent.com/zdealveindy/anadat-r/master/scripts/p.adjust.envfit.r')
and the script is here:
- p.adjust.envfit.r
# Function p.adjust.envfit # Calculates adjusted P values for results stored in envfit object, # created using envfit function from vegan, which fits supplementary variables # onto axes of unconstrained ordination. # Arguments: # x - envfit object # method - method for correction of multiple testing issue (default = 'bonferroni', # see ''?p.adjust' for more options) # n - optional, number of tests for which to correct; if not given, the number is # taken as the number of tests conducted by envfit function (for both vectors and factors). # Author: David Zeleny p.adjust.envfit <- function (x, method = 'bonferroni', n) { x.new <- x if (!is.null (x$vectors)) pval.vectors <- x$vectors$pvals else pval.vectors <- NULL if (!is.null (x$factors)) pval.factors <- x$factors$pvals else pval.factors <- NULL if (missing (n)) n <- length (pval.vectors) + length (pval.factors) if (!is.null (x$vectors)) x.new$vectors$pvals <- p.adjust (x$vectors$pvals, method = method, n = n) if (!is.null (x$factors)) x.new$factors$pvals <- p.adjust (x$factors$pvals, method = method, n = n) cat ('Adjustment of significance by', method, 'method') return (x.new) }
en/customized_functions/p.adjust.envfit.txt · Last modified: 2018/04/22 00:26 by David Zelený