Learn R Programming

adespatial (version 0.3-24)

tpaired.krandtest: Paired t-tests of differences between T1 and T2 for each species

Description

This function computes paired t-tests for each species, for abundances observed at time 1 (T1) and time 2 (T2). The test is one-tailed in the direction of the sign (+ or -) of the t statistic.

Usage

tpaired.krandtest(mat1, mat2, nperm = 99, list.all = FALSE)

Value

  • A table with species in rows and 6 columns: "mean(T1-T2)","t.stat","p.param","p.perm","p<=0.05","Sign(T1-T2)" The parametric and permutational p-values are not corrected for multiple tests. A star is shown in column "p<=0.05" if the parametric p-value is <= 0.05.

  • A list of names of the species tested; their t statistics were not 0.

  • A list of names of the species not tested because their t-statistics were 0.

Arguments

mat1

site-by-species data at time T1 (data.frame or matrix).

mat2

site-by-species data at time T2 (data.frame or matrix).

nperm

Number of permutations. Use 999, 9999, or more, to allow for correction of p-values for multiple tests.

list.all

If FALSE, the output matrix $t.tests only lists t.test results for species with t.stat not 0; If TRUE, the output matrix $t.tests lists t.test results for all species; when t.stat is 0, the p-values in the output table (p.param and p.perm) receive codes -999; Sign(T1-T2) receives the value 0.

Author

Pierre Legendre pierre.legendre@umontreal.ca

Details

The species that do not vary in either data set are discarded before calculation of the paired t-tests begins.

p-values should be corrected for multiple testing. Use function p.adjust of stats: p.adjust(res$t.test$p.param) or p.adjust(res$t.test$p.perm) Correction methods "holm" (default) and "hochberg" are fine for this type of analysis.

References

Legendre, P. 2019. A temporal beta-diversity index to identify sites that have changed in exceptional ways in space-time surveys. Ecology and Evolution (in press).

van den Brink, P. J. & C. J. F. ter Braak. 1999. Principal response curves: analysis of time-dependent multivariate responses of biological community to stress. Environmental Toxicology and Chemistry 18: 138-148.

See Also

tpaired.randtest

Examples

Run this code

if(require("vegan", quietly = TRUE)) {

## Invertebrate communities subjected to insecticide treatment.

## As an example in their paper on Principal Response Curves (PRC), van den Brink & ter 
## Braak (1999) used observations on the abundances of 178 invertebrate species 
## (macroinvertebrates and zooplankton) subjected to treatments in 12 mesocosms by the 
## insecticide chlorpyrifos. The mesocosms were sampled at 11 occasions. The data, 
## available in the {vegan} package, are log-transformed species abundances, 
## y.tranformed = loge(10*y+1).

## The data of survey #4 will be compared to those of survey #11 in this example.  
## Survey #4 was carried out one week after the insecticide treatment, whereas the 
## fauna of the mesocosms was considered to have fully recovered from the treatment 
## at the time of survey #11.

data(pyrifos)

## The mesocosms had originally been attributed at random to the treatments. However,  
## to facilitate presentation of the results, they will be listed here in order of 
## increased insecticide doses: {0, 0, 0, 0, 0.1, 0.1, 0.9, 0.9, 6, 6, 44, 44} 
## micro g/L.

survey4.order = c(38,39,41,47,37,44,40,46,43,48,42,45)

survey11.order = c(122,123,125,131,121,128,124,130,127,132,126,129)

## Paired t-tests of differences between survey.4 and survey.11 for the p species

res <- tpaired.krandtest(pyrifos[survey4.order,],pyrifos[survey11.order,])

}

Run the code above in your browser using DataLab