Feature #6384 ยป Metric_Statistics.R
1 |
#############
|
---|---|
2 |
###Statistics
|
3 |
#############
|
4 |
|
5 |
######
|
6 |
#ANOVA
|
7 |
require(car) |
8 |
|
9 |
lm.data <- lm(sum ~ trt, data=data) |
10 |
Anova(lm.data, type=3) |
11 |
summary(lm.data) |
12 |
|
13 |
#or
|
14 |
data.aov <- aov(sum ~ trt, data) |
15 |
|
16 |
############################
|
17 |
#Tukey multiple comparisons
|
18 |
TukeyHSD(data) |
19 |
|
20 |
#########
|
21 |
#pairwise
|
22 |
#method= "bonferroni", "fdr"
|
23 |
pairwise.t.test(data$var1, data$var2, p.adjust.method="none") |
24 |
|
25 |
##########
|
26 |
#PERMANOVA
|
27 |
#requires a reference data.frame with year, treatment, plot #... (of the same length as spp. cover matrix)
|
28 |
require(vegan) |
29 |
|
30 |
perm <- adonis(spp_matrix ~ treatment*year, data=enviro_info, perm=200) |
31 |
summary(perm) |
32 |
|
33 |
#######
|
34 |
#SIMPER
|
35 |
#requires a reference data.frame with year, treatment, plot #... (of the same length as spp. cover matrix)
|
36 |
require(vegan) |
37 |
|
38 |
spp_matrx.sim <- with(enviro_info, simper(spp_matrix, enviroVariable)) |
39 |
summary(spp_matrix.sim, ordered=TRUE, digits=max(3)) |