summary.CWMSNCr: Summary of a weigthed averaging-based analysis of...

View source: R/summary.CWMSNCr.r

summary.CWMSNCrR Documentation

Summary of a weigthed averaging-based analysis of trait-environment association

Description

summary.CWMSNCr summarizes the results of CWMSNC_regressions. For a single quantitative trait and a single quantitative environmental variable three types of correlations and p-values are given (sites, species, min/max). For nominal and multipe trait and environment data, one set of such correlations and p-values is printed (by default, the max p-values and signed minimum fourth-corner correlations) with an associated heatmap of the significant associations. The p-values can be adjusted for multiple testing.

Usage

## S3 method for class 'CWMSNCr'
summary(
  object,
  ...,
  digits = 3,
  type = "max",
  p_value_adjust_method = "fdr",
  significance_level = 0.05,
  silent = FALSE
)

Arguments

object

an object of class CWMSNCr, created by CWMSNC_regressions.

...

other optional arguments

digits

number of digits to print

type

"sites", "species" or "max" (default, which combines sites and species). Used only for multiple or nominal trait and environmental data

p_value_adjust_method

method for adjustment of the p-values for multiple comparison. "fdr" (default), "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", or "none". Used only for multiple or nominal trait and environmental data

significance_level

threshold for plotting a heatmap of the signed p-values

silent

no printed output when TRUE (default FALSE)

Details

p_value_adjust_method uses p.adjust on P-values of all pxq trait-environment combinations of the site-level and the species-level tests, which, for type == 'max' are subsequently combined by taking the maximum of the adjusted site P-value of the CWM regression and adjusted species P-value for the SNC regression for each combination. This adjustment method is the same as used in fourthcorner and is less conservative than applying p.adjust on the max P-values directly.

Value

For quantitative single trait-single environmental variable data: a numeric matrix with trait-environment correlations (first row) and p-values (second row) for sites, species and their min/max combination (columns). Correlations in the min/max column are signed minima of sites and species, being 0 if the correlations for sites and species differ in sign. p-values in the min/max column are the maximum of the p-values for sites and species.

For nominal or multiple trait/environment data: a list of

p_val_adj

the adjusted p-values

FCcorrelations

the (weighted) fourth corner correlations

heatmap

a gglot object containing the basis heatmap on the basis of argument significance_level

References

ter Braak (2019) New robust weighted averaging- and model-based methods for assessing trait-environment relationships. Methods in Ecology and Evolution (https://doi.org/10.1111/2041-210X.13278)

See Also

plot.CWMSNCr.

Examples

# get Aravo data set ----------------------------------------------------------
data("aravo",  package = "ade4")
Y <- aravo$spe
SLA <- aravo$traits$SLA
Snow <- aravo$env$Snow
nrepet <- 19 # change to e.g. 499 or 999
result <- CWMSNC_regressions(Snow, Y, SLA, weighing = "N2", nrepet = nrepet)
names(result)
result$p_values
summary(result)
plot(result)


Snow <- aravo$env$Snow
Spread <- log(aravo$traits$Spread)
result <- CWMSNC_regressions(Snow, Y, Spread, weighing = "N2", nrepet = nrepet)
result$p_values
summary(result)
# in the one E vector - one T vector case, you can choose your own labels
plot(result, trait = "log Spread", env = "Snow")

# untransformed analysis of all pairs. See TutorialWA_Aravo_Multi.r
#                                      for transformations that appear useful
#  data frames E,L,T
result <- CWMSNC_regressions(aravo$env, aravo$spe, aravo$traits, weighing = "N2", nrepet = nrepet)
#result$p_values # contains all pairwise p-values
#                  for site-based, species-based and max-based permutations
#result$wFC      # contains all pairwise weighted fourth-corner correlations
# (site-based, species-based, and signed min-based)
summary(result, type = "max", p_value_adjust_method = "fdr", significance_level = 0.05)
# in the  E or T matrix or data frame case,
# names shoud refer to names of variables or labels of factors
# The next statement generates the available valid names.
(nam.list <- plot(result, trait = "", env = "" ))
plot(result, trait = "Spread", env = "Snow" )
## All plots
# for (trait in nam.list$trait.names){
#   for (env in nam.list$env.names){
#     print(plot(result, trait = trait, env = env ))
#   }
# }


CajoterBraak/TraitEnvMLMWA documentation built on Jan. 25, 2023, 7:36 p.m.