R/tpaired.krandtest.R
tpaired.krandtest.Rd
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.
tpaired.krandtest(mat1, mat2, nperm = 99, list.all = FALSE)
site-by-species data at time T1 (data.frame or matrix).
site-by-species data at time T2 (data.frame or matrix).
Number of permutations. Use 999, 9999, or more, to allow for correction of p-values for multiple tests.
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.
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.
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.
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.
tpaired.randtest
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,])
}
#> 62 species were eliminated because they did not vary in the combined data set
#> 116 species retained:
#> 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
#>
#> 3 species not tested because t.stat = 0. See 'No_test' output list
#>