-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snow Analysis 1.R
39 lines (24 loc) · 1.34 KB
/
Snow Analysis 1.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
library(tidyverse)
ggplot(interaction, aes(x=timediff, y=Mspeed, color=interaction(factor(Crash), factor(Mramp)))) +
geom_line()
ggplot(interaction, aes(x=timediff, y=Adiversion, color=interaction(factor(Crash), factor(Mramp)))) +
geom_line()
plot(interaction$Mspeed, interaction$Cmspeed, type='n')
text(interaction$Mspeed, interaction$Cmspeed, interaction$Crash, col=ifelse(interaction$Signstate, "red","blue"))
abline(0,1)
plot(interaction$Adiversion, interaction$Cdiversion, type='n')
text(interaction$Adiversion, interaction$Cdiversion, interaction$Crash, col=ifelse(interaction$Signstate, "red","blue"))
abline(0,1)
plot(interaction$Mspeed, interaction$Cmspeed, type='n')
text(interaction$Mspeed, interaction$Cmspeed, interaction$Mramp, col=ifelse(interaction$Signstate, "red","blue"))
abline(0,1)
plot(interaction$Adiversion, interaction$Cdiversion, type='n')
text(interaction$Adiversion, interaction$Cdiversion, interaction$Mramp, col=ifelse(interaction$Signstate, "red","blue"))
abline(0,1)
library(lme4)
fit1 <- lmer(Mspeed ~ timediff*factor(Signstate) + (1|Crash/Mramp), data=interaction)
summary(fit1)
fit2 <- lmer(Adiversion ~ timediff*factor(Signstate) + (1|Crash/Mramp), data=interaction)
summary(fit2)
fit3<- lmer(Adiversion ~ Cdiversion*factor(Signstate) + timediff*factor(Signstate) + (1|Crash/Mramp), data=interaction)
summary(fit3)