-
Notifications
You must be signed in to change notification settings - Fork 0
/
ind_startle_speed.R
35 lines (25 loc) · 1.35 KB
/
ind_startle_speed.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
data_startle_speed <- read.csv("../../data/temp_collective/roi/stats_ind_startle_speed_loom.csv")
lm <- lm(max_startle_speed ~ Temperature + Groupsize + Loom, data_startle_speed)
summary(lm)
plot(fitted(lm),residuals(lm))
lm_quad <- lm(max_startle_speed ~ I(Temperature^2) + Groupsize + Loom, data_startle_speed)
summary(lm_quad)
plot(fitted(lm_quad),residuals(lm_quad))
lm_quad_lin <- lm(max_startle_speed ~ I(Temperature^2) + Temperature + Groupsize + Loom, data_startle_speed)
summary(lm_quad_lin)
plot(fitted(lm_quad_lin),residuals(lm_quad_lin))
require(MASS)
boxcox(lm,plotit=TRUE)
lm_quad_lin_trans <- lm(max_startle_speed^(-0.5) ~ I(Temperature^2) + Temperature + Groupsize + Loom, data_startle_speed)
summary(lm_quad_lin_trans)
plot(fitted(lm_quad_lin_trans),residuals(lm_quad_lin_trans))
lm_quad_lin_trans <- lm(log(max_startle_speed) ~ I(Temperature^2) + Temperature + Groupsize + Loom, data_startle_speed)
summary(lm_quad_lin_trans)
plot(fitted(lm_quad_lin_trans),residuals(lm_quad_lin_trans))
qqnorm(residuals(lm_quad_lin_trans))
qqline(residuals(lm_quad_lin_trans))
model_gamma <- glm(max_startle_speed ~ I(Temperature^2) + Temperature + Groupsize + Loom, family = Gamma, data_startle_speed )
summary(model_gamma)
lm <- lm(ratio ~ Temperature + Groupsize + Loom, data_startle_speed)
summary(lm)
plot(fitted(lm),residuals(lm))