test_cwm: Testing the relationship between weighted-mean of species...

Description Usage Arguments Details Value See Also Examples

Description

Function calculating relationship between weighted-mean of species attributes and sample attributes and performing standard (row based), modified (column based), or max test of significance.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
test_cwm(
  cwm,
  env,
  method = c("cor"),
  wcor = FALSE,
  wstand = FALSE,
  wreg = FALSE,
  wsamp = NULL,
  dependence = "cwm ~ env",
  perm = 499,
  test = "max",
  parallel = NULL,
  p.adjust.method = "holm",
  adjustP = FALSE
)

## S3 method for class 'testCWM'
print(
  x,
  digits = max(3, getOption("digits") - 3),
  missing.summary = FALSE,
  eps.Pvalue = 0.001,
  signif.stars = getOption("show.signif.stars"),
  ...
)

## S3 method for class 'testCWM'
coef(object, ...)

## S3 method for class 'testCWM'
plot(
  x,
  alpha = 0.05,
  line = NA,
  cex.lab = 1.5,
  par.mar = c(0.5, 0.5, 0.5, 0.5),
  box.col = c("blue", "red"),
  box.lwd = 2,
  ...
)

Arguments

cwm

An object of the class cwm.

env

Vector or matrix with variables. See details.

method

Statistical method used to analyse the relationship between cwm (of class cwm) and env (sample attributes); partial match to 'cor', 'lm' and 'aov'.

wcor

Logical; should the correlation be weighted by rowsums of com (extracted from cwm?). Default FALSE.

wstand

Logical; should the variables in correlation be first weighted-standardized? Default FALSE. If wstand = TRUE, both env and traits are weighted standardized prior to calcuation; weights are derived from com matrix (extracted from cwm); env is weighted by rowsums of com, while traits are weighted by colsums of com.

wreg

Logical; should weights be used in the regression (method = 'lm')? If TRUE, weighted least squares are calculated instead of ordinary least squares.

wsamp

Either NULL (default) or a numeric vector; if wreg = TRUE, weights provided here are used to calculate weighted least square regression; if wsamp = NULL, rowSums (com) are used as weights. NOT IMPLEMENTED YET.

dependence

Should cwm be dependent variable and env independent ('cwm ~ env'), or opposite? Applicable only for method = 'lm'. Partial match to 'cwm ~ env' and 'env ~ cwm'.

perm

Number of permutations.

test

Vector of character values. Which test should be conducted? Partial match to 'standard' or 'rowbased' for standard (row based) permutation test, 'modified' or 'colbased' for modified (column based) permutation test, 'max' for max test (selecting the higher from rowbased and colbased result), and 'all' including all three tests. See Details.

parallel

NULL (default) or integer number. Number of cores for parallel calculation of modified permutation test. Maximum number of cores should correspond to number of available cores on the processor.

p.adjust.method

A string indicating the method of P-value adjustement, see p.adjust.methods for possible choices.

adjustP

Logical, default FALSE. Should be the P-values adjusted? If adjustP = TRUE, the last column in the results is adjusted by method selected in p.adjust.method.

x, object

object of the class "cwm", generated by function cwm.

digits

number of digits reported by print method on object of "cwm" class (default is 3).

missing.summary

Logical; should be the summary of values missing in env, cwm and traits be printed along to the result of test_cwm analysis? Default is TRUE.

eps.Pvalue

Values of P below this threshold will be printed as < [eps] in the output.

signif.stars

Logical; if TRUE, P-values are additionally encoded visually as 'significance stars' in order to help scanning of long coefficient tables. It defaults to the show.signif.stars slot of options.

...

Other arguments for print, summary, coef or plot functions (some not implemented yet).

alpha, line, cex.lab, par.mar, box.col, box.lwd

Graphical parameters for plot function.

Details

Currently implemented statistical methods: 'cor', 'lm' and 'aov'. For fourth corner use test_fourth.

Argument env can be vector or matrix with one column. Only in the case of linear regression (method = 'lm') it is possible to use matrix with several variables, which will all be used as independent variables in the model. For ANOVA and Kruskal-Wallis test, make sure that 'env' is factor (warning will be returned if this is not the case, but the calculation will be conducted).

Specific issue related to weighted mean is the case of missing species attributes. In current implementation, species with missing species attributes are removed from sample x species matrix prior to permutation of species attributes among species.

The plot functions will plot pairwise relationships between CWM and environmental variables, as a scatterplots in case of method = 'cor' and 'lm' and as boxplot in case of method = 'aov'. Significant relationships are highlighted in the figure by colorful border; the P-values used for this highlighting are the last one listed in the summary output. If you don't like this behaviour, limit the analysis to a single test only - in that case this test will be used to highlight the significant results.

Value

Function cwm returns list of the class "cwm" (with print and summary methods), which contains the following components:

See Also

cwm, snc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data (vltava)

# Traits vs environment (tested by max test)
CWM_traits <- cwm (com = vltava$herbs$spe, traits = vltava$herbs$traits)
re_traits <- test_cwm (cwm = CWM_traits, env = vltava$env[,c('pH', 'COVERE32')],
 method = 'lm', adjustP = TRUE)
re_traits
plot (re_traits)

# Ellenberg indicator values vs assignment of plots into groups (by cluster analysis)
# (tested by modified (column-based) permutation test)
CWM_ell <- cwm (com = vltava$spe, traits = vltava$civ[,1:5]) 
re_ell <- test_cwm (cwm = CWM_ell, env = as.factor (vltava$env$GROUP), test = 'modif',
 method = 'aov', adjustP = TRUE)
re_ell
plot (re_ell)

zdealveindy/weimea documentation built on Sept. 21, 2021, 2:15 p.m.