-
Notifications
You must be signed in to change notification settings - Fork 0
/
latency_loom.R
132 lines (96 loc) · 3.28 KB
/
latency_loom.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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
setwd("~/Documents/code/stats")
data <- read.csv("../../data/temp_collective/roi/stats_loom_latency_nan.csv",header=TRUE,na.strings=c("[nan]"))
lat <- data$latency
#lat <- as.numeric(lat1)
temp <- data$Temperature
gs <- data$Groupsize
loom <- data$loom
n <- length(lat)
model1 <- lm(lat ~ temp + gs,data)
summary(model1)
model2 <- lm(lat ~ temp*gs,data)
summary(model2)
model3 <- lm(lat ~ temp + gs + loom,data)
summary(model3)
model4 <- lm(lat ~ temp*gs + loom,data)
summary(model4)
model5 <- lm(lat ~ temp+gs + loom+I(temp^2),data)
summary(model5)
model6 <- lm(lat ~ temp*gs + loom+I(temp^2),data)
summary(model6)
model7 <- lm(lat ~ temp*loom + gs +I(temp^2),data)
summary(model7)
model8 <- lm(lat ~ loom*gs + temp + I(temp^2),data)
summary(model8)
plot(fitted(model8), residuals(model8))
qqnorm(residuals(model8))
qqline(residuals(model8))
model9 <- lm(lat ~ temp*loom*gs +I(temp^2),data)
summary(model9)
plot(fitted(model9), residuals(model9))
qqnorm(residuals(model9))
qqline(residuals(model9))
model10 <- lm(lat ~ temp*loom*gs*I(temp^2),data)
summary(model10)
plot(fitted(model10), residuals(model10))
qqnorm(residuals(model10))
qqline(residuals(model10))
model_pois <- glm(lat ~ temp + gs + I(temp^2), family = quasipoisson, data)
summary(model_pois)
model_pois2 <- glm(lat ~ temp*gs, family = quasipoisson, data)
summary(model_pois2)
model_pois3 <- glm.nb(lat ~ temp*gs, data)
summary(model_pois3)
setwd("~/Documents/code/stats")
data <- read.csv("../../data/temp_collective/roi/stats_loom_latency_nan.csv",header=TRUE,na.strings=c("[nan]"))
lat <- data$latency
#lat <- as.numeric(lat1)
temp <- data$Temperature
gs <- data$Groupsize
loom <- data$loom
n <- length(lat)
model1 <- lm(lat ~ temp + gs,data)
summary(model1)
model2 <- lm(lat ~ temp*gs,data)
summary(model2)
model3 <- lm(lat ~ temp + gs + loom,data)
summary(model3)
model4 <- lm(lat ~ temp*gs + loom,data)
summary(model4)
model5 <- lm(lat ~ temp+gs + loom+I(temp^2),data)
summary(model5)
model6 <- lm(lat ~ temp*gs + loom+I(temp^2),data)
summary(model6)
model7 <- lm(lat ~ temp*loom + gs +I(temp^2),data)
summary(model7)
model8 <- lm(lat ~ loom*gs + temp + I(temp^2),data)
summary(model8)
plot(fitted(model8), residuals(model8))
qqnorm(residuals(model8))
qqline(residuals(model8))
model9 <- lm(lat ~ temp*loom*gs +I(temp^2),data)
summary(model9)
plot(fitted(model9), residuals(model9))
qqnorm(residuals(model9))
qqline(residuals(model9))
model10 <- lm(lat ~ temp*loom*gs*I(temp^2),data)
summary(model10)
plot(fitted(model10), residuals(model10))
qqnorm(residuals(model10))
qqline(residuals(model10))
model_pois <- glm(lat ~ temp + gs, family = quasipoisson, data)
summary(model_pois)
model_pois2 <- glm(lat ~ temp*gs, family = quasipoisson, data)
summary(model_pois2)
model_pois3 <- glm.nb(lat ~ temp*gs, data)
summary(model_pois3)
model_pois4 <- glm(lat ~ temp + gs + I(temp^2), family = quasipoisson, data)
summary(model_pois4)
model_pois5 <- glm(lat ~ temp + gs*I(temp^2), family = quasipoisson, data)
summary(model_pois5)
### this is the one
model_pois6 <- glm(lat ~ temp + gs*loom + I(temp^2), family = quasipoisson, data)
summary(model_pois6)
require(faraway)
cook <- cooks.distance(model_pois6)
halfnorm(cook)