# test.MR: Testing the relationship between weighted-mean of species... In zdealveindy/weimea: Weighted mean analysis

## Description

Function performing standard, modified, two-step and sequential test to calculate significance of relationship between weighted-mean of species attributes and sample attributes.

## Usage

 1 2 3 4 5 6 7 8 9 10 test.MR(M, env, method = c("cor"), cor.coef = c("pearson"), dependence = "M ~ env", perm = 499, testLR.perm = NULL, test = "twostep", fc.test = 6, parallel = NULL, testLR.P = 0.05, chessel = FALSE) ## S3 method for class 'testMR' print(x, digits = max(3, getOption("digits") - 3), ...) ## S3 method for class 'testMR' coef(object, ...)

## Arguments

 M An object of the class wm env Vector or matrix with variables. See details. method Statistical method used to analyse the relationship between M (of class wm) and env (sample attributes); partial match to 'lm', 'cor' and 'fourthcorner'. cor.coef Correlation coefficient for method = 'cor'. Partial match to 'pearson' and 'spearman'. dependence Should M be dependent variable and env independent ('M ~ env'), or opposite? Applicable only for method = 'lm'. Partial match to 'M ~ env' and 'env ~ M'. perm Number of permutations. testLR.perm Relevant if test = "twostep" (default): number of permutations for test of relationship between L and R matrices. test Vector of character values. Which test should be conducted? Partial match of vector with 'standard', 'modified', 'twostep', 'sequential' and 'all'. See Details. fc.test Test for the fourthcorner method. fc.test = c(2,4,6). 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. testLR.P Relevant if test = "twostep" (default): significance value at whitch the relationship between L and R matrices are significant. chessel Logical; should the Chessel's variant of the fourth corner statistic be returned? Default is FALSE. See Details in ?fourth.corner. x, object object of the class "wm", generated by function wm. digits number of digits reported by print method on object of "wm" class (default is 3). ... Other arguments for print, summary or coef functions (not implemented yet).

## Details

Currently implemented statistical methods are ('cor', 'lm', 'fourthcorner').

Argument env can be vector or matrix with one column. Only in 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).

Difference between method = 'lm' and 'aov' is in the format of summary tables, returned by summary.wm function. In case of 'aov', this summary is expressed in the traditional language of ANOVA rather than linear models.

Both method = 'lm' and 'slope' are based on linear regression and calculated by function lm, but differ by test statistic: while 'lm' is using F value and is testing the strength of the regression (measured by r2), 'slope' is using the slope of the regression line (b). This statistic is added here for comparison with the fourth corner method. While r2 (and r) is influenced by the issue of compositional autocorrelation, slope of regression is not.

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.

## Value

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

• real.summaries summary of the method

• coefs model coefficients

• stat test statistic

• orig.P P-values from the original (parametric) test

• perm.P P-values from the not-modified permutation test (permuted are the whole rows of matrix M)

• modif.P P-values from the modified permutation test (permuted are species attributes in object M)

• seq.P P-values from sequential test (max (perm.P, modif.P))

• perm number of permutations

• method method of calculation

• dependence dependence (in case of method = 'lm')

## Examples

 1 2 3 data (vltava) M <- wm (sitspe = vltava\$herbs\$spe, speatt = vltava\$herbs\$traits) re <- test.MR (M = M, env = vltava\$env[,c('pH', 'COVERE32')])

zdealveindy/weimea documentation built on Dec. 5, 2017, 11:25 p.m.