-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.RMANOVA.R
89 lines (65 loc) · 1.74 KB
/
script.RMANOVA.R
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
# RMANOVA
# Analisis de medidas repetidas
setwd("~/Documents/1_WORKING/DATA/")
dir()
d<-read.delim("Rmanova.txt")
str(d)
dotchart(d$Eggs)
interaction.plot(d$Time, factor(d$Group), d$Eggs)
plot(d, outer=T)
#Mixed-effect models
library(nlme)
model <- lme(
(Eggs) ~ factor(Time),
random = ~1|ID,
data=d
)
plot(model)#homogeneidad de varianzas
qqnorm(model, ~resid(.)|ID)# normalidad de las replicas
summary(model)
anova(model)
#analizando con mixed.model
model2 <-lme(
(Eggs) ~ factor(Group)+factor(Time),
random = ~1|ID, data=d
)
anova(model2)
plot(model2)
########################################################
#datos colectores
mod_colector<-lme(
(TASA)+(MES) ~ (PROFUNDIDAD),
# (TASA) ~ (PROFUNDIDAD)+(MES),
# (TASA) ~ (PROFUNDIDAD),
# (TASA) ~ (MES),
random = ~1|REPLICA, data=long.data,
na.action = na.exclude
)
summary(mod_colector)
anova(mod_colector)
plot(mod_colector)
# post-Hoc testing http://stats.stackexchange.com/questions/14078/post-hoc-test-after-anova-with-repeated-measures-using-r
install.packages("multcomp")
library(multcomp)
# lme_velocity = lme(Velocity ~ Material, data=scrd, random = ~1|Subject)
# anova(lme_velocity)
#
# require(multcomp)
# summary(glht(lme_velocity, linfct=mcp(Material = "Tukey")), test = adjusted(type = "bonferroni"))
#entre campañas
summary(
glht(
mod_colector, linfct=mcp(MES = "Tukey")), test = adjusted(type = "bonferroni")
)
#entre profundidad
summary(
glht(
mod_colector, linfct=mcp(PROFUNDIDAD = "Tukey")),
test = adjusted(type = "bonferroni")
)
#ambas variables
summary(
glht(
mod_colector, linfct=mcp(MES="Tukey", PROFUNDIDAD = "Tukey")),
test = adjusted(type = "bonferroni")
)