-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_Descriptive_analyses_temp.R
More file actions
245 lines (181 loc) · 8.17 KB
/
03_Descriptive_analyses_temp.R
File metadata and controls
245 lines (181 loc) · 8.17 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
####################################################################################################################
# Analysis of implant data from foxes for:
# Shapiro et al.
# Potential for real-time health and welfare monitoring in experimental rabies infection in red fox (Vulpes vulpes)
# using implants
#
# Script 3: For each fox, calculates summary statistics for temperature and performs t-tests to compare
# calibration and monitoring periods
#
#
# Uses the following data frames created in Script 01_Load_data.R :
# df_0fae2, df_0faf2, df_0fb1.2, df_0fb0.2
#
# Script tested for R version 4.1.2
####################################################################################################################
####################################################################################################################
# Load packages ####
####################################################################################################################
# Load packages (install if necessary)
library(tidyverse)
####################################################################################################################
####################################################################################################################
# Fox 0fae ####
####################################################################################################################
# 15min intervals ####
df.0fae.temp.descr <- df_0fae2 %>%
mutate(timePeriod = floor_date(date_time_min, "15minutes")) %>%
group_by(timePeriod) %>%
filter(timePeriod >= "2022-07-9") %>%
# Note : data collected by implant for some days after death, need to filter out
# Note : probably due to timezone issue in R or tidyverse must specifiy 19:00 to keep data points up to 17h on 18-08
filter(timePeriod <= "2022-08-18 19:00:00") %>%
summarise(Temp = mean(Temp))
# Summary overall
summary(df.0fae.temp.descr)
# Split data into calibration and monitoring periods :
avant_0fae.temp.descr <- df.0fae.temp.descr %>%
filter(timePeriod >= "2022-07-9") %>%
filter(timePeriod <= "2022-07-19")
apres_0fae.temp.descr <- df.0fae.temp.descr %>%
filter(timePeriod > "2022-07-19")
# Summaries for each :
summary(avant_0fae.temp.descr)
summary(apres_0fae.temp.descr)
# Daily (24h) ####
df.0fae.temp.descr.24h <- df_0fae2 %>%
mutate(timePeriod = floor_date(date_time_min, "1day")) %>%
group_by(timePeriod) %>%
# Note : data collected by implant for some days after death, need to filter out
# Note : probably due to timezone issue in R or tidyverse must specifiy 19:00 to keep data points up to 17h on 18-08
filter(timePeriod <= "2022-08-18 19:00:00") %>%
summarise(Temp = mean(Temp))
# Summary
summary(df.0fae.temp.descr.24h)
# Split data into calibration and monitoring periods :
avant_0fae.temp.descr.24h <- df.0fae.temp.descr.24h %>%
filter(timePeriod >= "2022-07-9") %>%
filter(timePeriod <= "2022-07-19")
apres_0fae.temp.descr.24h <- df.0fae.temp.descr.24h %>%
filter(timePeriod > "2022-07-19")
# Summaries for each
summary(avant_0fae.temp.descr.24h)
summary(apres_0fae.temp.descr.24h)
# t-test (daily 24h)
t.test(avant_0fae.temp.descr.24h$Temp, apres_0fae.temp.descr.24h$Temp)
####################################################################################################################
####################################################################################################################
# Fox 0fb0 ####
####################################################################################################################
# 15min intervals ####
df.0fb0.temp.descr <- df_0fb0.2 %>%
mutate(timePeriod = floor_date(date_time_min, "15minutes")) %>%
group_by(timePeriod) %>%
summarise(Temp = mean(Temp))
# Summary overall
summary(df.0fb0.temp.descr)
# Split data into calibration and monitoring periods :
avant_0fb0.temp.descr <- df.0fb0.temp.descr %>%
filter(timePeriod >= "2022-07-9") %>%
filter(timePeriod <= "2022-07-19")
apres_0fb0.temp.descr <- df.0fb0.temp.descr %>%
filter(timePeriod > "2022-07-19")
# Summaries for each
summary(avant_0fb0.temp.descr)
summary(apres_0fb0.temp.descr)
# Daily (24h) ####
df.0fb0.temp.descr.24h <- df_0fb0.2 %>%
mutate(timePeriod = floor_date(date_time_min, "1day")) %>%
group_by(timePeriod) %>%
summarise(Temp = mean(Temp))
# Daily summary
summary(df.0fb0.temp.descr.24h)
# Split data into calibration and monitoring periods :
avant_0fb0.temp.descr.24h <- df.0fb0.temp.descr.24h %>%
filter(timePeriod >= "2022-07-9") %>%
filter(timePeriod <= "2022-07-19")
apres_0fb0.temp.descr.24h <- df.0fb0.temp.descr.24h %>%
filter(timePeriod > "2022-07-19")
# Summaries for each
summary(avant_0fb0.temp.descr.24h)
summary(apres_0fb0.temp.descr.24h)
# t-test (daily 24h)
t.test(avant_0fb0.temp.descr.24h$Temp, apres_0fb0.temp.descr.24h$Temp)
####################################################################################################################
####################################################################################################################
# Fox 0faf ####
####################################################################################################################
# 15min intervals ####
df.0faf.temp.descr <- df_0faf2 %>%
mutate(timePeriod = floor_date(date_time_min, "15minutes")) %>%
group_by(timePeriod) %>%
summarise(Temp = mean(Temp))
# Summary overall
summary(df.0faf.temp.descr)
# Split data into calibration and monitoring periods :
avant_0faf.temp.descr <- df.0faf.temp.descr %>%
filter(timePeriod >= "2022-07-9") %>%
filter(timePeriod <= "2022-07-19")
apres_0faf.temp.descr <- df.0faf.temp.descr %>%
filter(timePeriod > "2022-07-19")
# Summaries for each :
summary(avant_0faf.temp.descr)
summary(apres_0faf.temp.descr)
# Daily (24h) ####
df.0faf.temp.descr.24h <- df_0faf2 %>%
mutate(timePeriod = floor_date(date_time_min, "1day")) %>%
group_by(timePeriod) %>%
filter(timePeriod <= "2022-08-18") %>%
summarise(Temp = mean(Temp))
# Daily summary
summary(df.0faf.temp.descr.24h)
# Split data into calibration and monitoring periods :
avant_0faf.temp.descr.24h <- df.0faf.temp.descr.24h %>%
filter(timePeriod >= "2022-07-9") %>%
filter(timePeriod <= "2022-07-19")
apres_0faf.temp.descr.24h <- df.0faf.temp.descr.24h %>%
filter(timePeriod > "2022-07-19")
# Summaries for each
summary(avant_0faf.temp.descr.24h)
summary(apres_0faf.temp.descr.24h)
# t-test
t.test(avant_0faf.temp.descr.24h$Temp, apres_0faf.temp.descr.24h$Temp)
####################################################################################################################
####################################################################################################################
# Fox 0fb1 ####
####################################################################################################################
# 15min intervals ####
df.0fb1.temp.descr <- df_0fb1.2 %>%
mutate(timePeriod = floor_date(date_time_min, "15minutes")) %>%
group_by(timePeriod) %>%
summarise(Temp = mean(Temp))
# Summary overall
summary(df.0fb1.temp.descr)
# Split data into calibration and monitoring periods :
avant_0fb1.temp.descr <- df.0fb1.temp.descr %>%
filter(timePeriod >= "2022-07-9") %>%
filter(timePeriod <= "2022-07-19")
apres_0fb1.temp.descr <- df.0fb1.temp.descr %>%
filter(timePeriod > "2022-07-19")
# Summaries for each :
summary(avant_0fb1.temp.descr)
summary(apres_0fb1.temp.descr)
# Daily (24h) ####
df.0fb1.temp.descr.24h <- df_0fb1.2 %>%
mutate(timePeriod = floor_date(date_time_min, "1day")) %>%
group_by(timePeriod) %>%
summarise(Temp = mean(Temp))
# Daily summary
summary(df.0fb1.temp.descr.24h)
# Split data into calibration and monitoring periods :
avant_0fb1.temp.descr.24h <- df.0fb1.temp.descr.24h %>%
filter(timePeriod >= "2022-07-9") %>%
filter(timePeriod <= "2022-07-19")
apres_0fb1.temp.descr.24h <- df.0fb1.temp.descr.24h %>%
filter(timePeriod > "2022-07-19")
# Summaries for each :
summary(avant_0fb1.temp.descr.24h)
summary(apres_0fb1.temp.descr.24h)
# t-test
t.test(avant_0fb1.temp.descr.24h$Temp, apres_0fb1.temp.descr.24h$Temp)
####################################################################################################################