-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathL&M_manuscript_rev2.Rmd
411 lines (346 loc) · 15 KB
/
L&M_manuscript_rev2.Rmd
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
---
title: "R Notebook for Feliciano-Ramos et al., 2023"
output:
html_notebook: default
pdf_document: default
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook.
To perform statistical analysis you need to download the R functions from
https://dornsife.usc.edu/labs/rwilcox/software/ or from github
https://github.com/nicebread/WRS
```{r}
# Make sure the code is in your path
source("Rallfun-v40.txt")
```
### supplementary Figure 2 E1
RTC AND PFC ON and OFF duration distributions
```{r}
suppFig1E1 <- read.csv("suppFig1E1.txt")
boxplot(suppFig1E1)
summary(suppFig1E1)
btrim(suppFig1E1, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
linconbt(suppFig1E1, con=0, tr=0.2, alpha=0.05, nboot=599) # 20% trimmed group means with bootstrap-t method
# lincon(suppFig1E1, con=0, tr=0.2, alpha=0.05) # without bootstrap-t
```
### supplementary Figure 2 F1
RTC AND PFC ON and OFF inter event interval(IEI) distributions
```{r}
suppFig1F1 <- read.csv("suppFig1F1.txt ")
boxplot(suppFig1F1)
summary(suppFig1F1)
btrim(suppFig1F1, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
linconb(suppFig1F1,con=0,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### Figure 3A
One-Way Robust Testing see: chapter 7 Introduction to Robust Estimation and hypothesis Testing
```{r}
data_fig3A <- read.csv("fig3A.txt ")
boxplot(data_fig3A)
summary(data_fig3A)
btrim(data_fig3A, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0),c(0,0,1,-1)) # matrix for group testing
linconb(data_fig3A,con=0,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
#med1way(data_fig3A1)
```
### supplementary Figure 3A1
One-Way Robust Testing see
```{r}
supp_data_fig3A1 <- read.csv("suppFig3A1.txt ")
boxplot(supp_data_fig3A1)
summary(supp_data_fig3A1)
btrim(supp_data_fig3A1, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0),c(0,0,1,-1)) # matrix for group testing
linconb(supp_data_fig3A1,con=0,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### supplementary Figure 3B1
One-Way Robust Testing
```{r}
supp_data_fig3B1 <- read.csv("suppFig3B1.txt ")
boxplot(supp_data_fig3B1)
summary(supp_data_fig3B1)
btrim(supp_data_fig3B1, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0),c(0,0,1,-1)) # matrix for group testing
linconb(supp_data_fig3B1,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### Figure 3B
```{r}
data_fig3B <- read.csv("fig3B.txt ")
boxplot(data_fig3B)
summary(data_fig3B)
btrim(data_fig3B, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0,0,0),c(0,0,1,-1,0,0),c(0,0,0,0,1,-1)) # matrix for group testing
linconb(data_fig3B,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### supplementary Figure 3A2
RTC vs Shuffles for Ripples occurring during cortical ON periods
```{r}
supp_fig3A2 <- read.csv("suppFig3A2.txt ")
boxplot(supp_fig3A2)
summary(supp_fig3A2)
btrim(supp_fig3A2, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0,0,0),c(0,0,1,-1,0,0),c(0,0,0,0,1,-1), c(0,1,0,-1,0,0)) # matrix for group testing
linconb(supp_fig3A2,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### supplementary Figure 3B2
PFC vs Shuffles for Ripples occurring during cortical ON periods
```{r}
supp_data_fig3B2 <- read.csv("suppFig3B2.txt ")
boxplot(supp_data_fig3B2)
summary(supp_data_fig3B2)
btrim(supp_data_fig3B2, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0,0,0),c(0,0,1,-1,0,0),c(0,0,0,0,1,-1), c(0,1,0,-1,0,0)) # matrix for group testing
linconb(supp_data_fig3B2,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
## Figure 3C
RTC vs PFC Down-states configurations
```{r}
data_fig3C <- read.csv("fig3C.txt ")
boxplot(data_fig3C)
summary(data_fig3C)
btrim(data_fig3C, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0,0,0),c(0,0,1,-1,0,0),c(0,0,0,0,1,-1)) # matrix for group testing
linconb(data_fig3C,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
## Supplementary Figure 3A3
```{r}
supp_data_fig3A3 <- read.csv("suppFig3A3.txt ")
boxplot(supp_data_fig3A3)
summary(supp_data_fig3A3)
btrim(supp_data_fig3A3, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0,0,0),c(0,0,1,-1,0,0),c(0,0,0,0,1,-1), c(0,1,0,-1,0,0)) # matrix for group testing
linconb(supp_data_fig3A3,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
## Supplementary Figure 3B3
```{r}
supp_data_fig3B3 <- read.csv("suppFig3B3.txt ")
boxplot(supp_data_fig3B3)
summary(supp_data_fig3B3)
btrim(supp_data_fig3B3, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0,0,0),c(0,0,1,-1,0,0),c(0,0,0,0,1,-1), c(0,1,0,-1,0,0)) # matrix for group testing
linconb(supp_data_fig3B3,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### supplementary Figure 3C1
RTC and PFC vs Shuffles Ratio
```{r}
supp_data_fig3C1 <- read.csv("suppFig3C1.txt ")
boxplot(supp_data_fig3C1)
summary(supp_data_fig3C1)
btrim(supp_data_fig3C1, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,0,-1,0,0,0),c(0,1,-1,0,0,0),c(0,0,-1,1,0,0),c(0,0,-1,0,-1,0),c(0,0,-1,0,0,-1)) # matrix for group testing
linconb(supp_data_fig3C1,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### supplementary Figure 3C2
RTC and PFC vs Down Shuffles Ratio
```{r}
supp_data_fig3C2 <- read.csv("suppFig3C2.txt ")
boxplot(supp_data_fig3C2)
summary(supp_data_fig3C2)
btrim(supp_data_fig3C2, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,0,-1,0,0,0),c(0,1,-1,0,0,0),c(0,0,-1,1,0,0),c(0,0,-1,0,-1,0),c(0,0,-1,0,0,-1)) # matrix for group testing
linconb(supp_data_fig3C2,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### supplementary Figure 3D
One-Way Robust Testing
```{r}
supp_data_fig3D <- read.csv("suppFig3D.txt")
boxplot(supp_data_fig3D)
summary(supp_data_fig3D)
btrim(supp_data_fig3D, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0),c(0,0,1,-1)) # matrix for group testing
linconb(supp_data_fig3D,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### supplementary Figure 3E1
One-Way Robust Testing
```{r}
supp_data_fig3E1 <- read.csv("suppFig3E1.txt")
boxplot(supp_data_fig3E1)
summary(supp_data_fig3E1)
btrim(supp_data_fig3E1, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0),c(0,0,1,-1)) # matrix for group testing
linconb(supp_data_fig3E1,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### supplementary Figure 3E2
One-Way Robust Testing
```{r}
supp_data_fig3E2 <- read.csv("suppFig3E2.txt")
boxplot(supp_data_fig3E2)
summary(supp_data_fig3E2)
```
### Figure 4
Delta and Down-State Phase Distribution
```{r}
data_fig4B3 <- read.csv("C:\\Users\\pdrfl\\DataAnalysis\\L&M_data_&_code\\Fig4\\fig4B3.txt ")
boxplot(data_fig4B3)
summary(data_fig4B3)
# Bootstrap-t Methods for Comparing trimmed means
yuenbt(data_fig4B3[,1],data_fig4B3[,2],tr=0.2,alpha=0.05,nboot=599,side=F)
ESfun(data_fig4B3[,1],data_fig4B3[,2]) # explanatory power
trimpb2(data_fig4B3[,1],data_fig4B3[,2],tr=0.2,alpha=0.05,nboot=2000,WIN=F,win=0.1)
```
### supplementary Figure 5 A1
Peak Amplitude Down-onset
```{r}
suppFig4A1 <- read.csv("suppFig5A1.txt ")
boxplot(suppFig4A1)
summary(suppFig4A1)
# Bootstrap-t Methods for Comparing trimmed means
yuenbt(suppFig4A1[,1],suppFig4A1[,2],tr=0.2,alpha=0.05,nboot=599,side=F)
ESfun(suppFig4A1[,1],suppFig4A1[,2]) # explanatory power
trimpb2(suppFig4A1[,1],suppFig4A1[,2],tr=0.2,alpha=0.05,nboot=2000,WIN=F,win=0.1)
```
### Supplementary Figure 5 A2
Down-state onset Variance after a SWR
```{r}
suppFig4A2 <- read.csv("suppFig5A2.txt ")
boxplot(suppFig4A2)
summary(suppFig4A2)
# Bootstrap-t Methods for Comparing trimmed means
yuenbt(suppFig4A2[,1],suppFig4A2[,2],tr=0.2,alpha=0.05,nboot=599,side=F)
ESfun(suppFig4A2[,1],suppFig4A2[,2]) # explanatory power
trimpb2(suppFig4A2[,1],suppFig4A2[,2],tr=0.2,alpha=0.05,nboot=2000,WIN=F,win=0.1)
```
### supplementary Figure 5 A3
Peak Timing of a Down-state onset
```{r}
suppFig4A3 <- read.csv("suppFig5A3.txt ")
boxplot(suppFig4A3)
summary(suppFig4A3)
# Bootstrap-t Methods for Comparing trimmed means
yuenbt(suppFig4A3[,1],suppFig4A3[,2],tr=0.2,alpha=0.05,nboot=599,side=F)
ESfun(suppFig4A3[,1],suppFig4A3[,2]) # explanatory power
trimpb2(suppFig4A3[,1],suppFig4A3[,2],tr=0.2,alpha=0.05,nboot=2000,WIN=F,win=0.1)
```
### supplementary Figure 5 A4
Peak Timing of a Down-state onset
```{r}
suppFig4A4 <- read.csv("suppFig5A4.txt ")
boxplot(suppFig4A4)
summary(suppFig4A4)
# Bootstrap-t Methods for Comparing trimmed means
yuenbt(suppFig4A4[,1],suppFig4A4[,2],tr=0.2,alpha=0.05,nboot=599,side=F)
ESfun(suppFig4A4[,1],suppFig4A4[,2]) # explanatory power
trimpb2(suppFig4A4[,1],suppFig4A4[,2],tr=0.2,alpha=0.05,nboot=2000,WIN=F,win=0.1)
```
## supplementary Figure 5 B1 and B2
```{r}
suppFig4B1_2 <- read.csv("suppFig5B1_&B2.txt ")
boxplot(suppFig4B1_2)
summary(suppFig4B1_2)
btrim(suppFig4B1_2, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0),c(0,0,1,-1),c(1,0,-1,0),c(0,1,0,-1)) # matrix for group testing
linconb(suppFig4B1_2,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### supplementary Figure 5 D2
Sust. UP-State MUA RTC
```{r}
suppFig5D2 <- read.csv("suppFig5D2.txt ")
boxplot(suppFig5D2)
summary(suppFig5D2)
# Bootstrap-t Methods for Comparing trimmed means
yuenbt(suppFig5D2[,1],suppFig5D2[,2],tr=0.2,alpha=0.05,nboot=599,side=F)
ESfun(suppFig5D2[,1],suppFig5D2[,2]) # explanatory power
trimpb2(suppFig5D2[,1],suppFig5D2[,2],tr=0.2,alpha=0.05,nboot=2000,WIN=F,win=0.1)
```
### supplementary Figure 5 D4
Sust. UP-State MUA PFC
```{r}
suppFig5D4 <- read.csv("suppFig5D4.txt ")
boxplot(suppFig5D4)
summary(suppFig5D4)
# Bootstrap-t Methods for Comparing trimmed means
yuenbt(suppFig5D4[,1],suppFig5D4[,2],tr=0.2,alpha=0.05,nboot=599,side=F)
ESfun(suppFig5D4[,1],suppFig5D4[,2]) # explanatory power
trimpb2(suppFig5D4[,1],suppFig5D4[,2],tr=0.2,alpha=0.05,nboot=2000,WIN=F,win=0.1)
```
## supplementary Figure 5 E2
Sust. UP-State Delta RTC
```{r}
suppFig5E2 <- read.csv("suppFig5E2.txt ")
boxplot(suppFig5E2)
summary(suppFig5E2)
btrim(suppFig5E2, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0),c(0,0,-1,0)) # matrix for group testing
linconb(suppFig5E2,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
## supplementary Figure 5 E3
Sust. UP-State Delta PFC
```{r}
suppFig5E3 <- read.csv("suppFig5E3.txt ")
boxplot(suppFig5E3)
summary(suppFig5E3)
btrim(suppFig5E3, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,-1,0,0),c(0,0,1,-1)) # matrix for group testing
linconb(suppFig5E3,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
## supplementary Figure 5 F2
Sust. UP-State Spindle RTC
```{r}
suppFig5F2 <- read.csv("suppFig5F2.txt ")
boxplot(suppFig5F2)
summary(suppFig5F2)
# Bootstrap-t Methods for Comparing trimmed means
yuenbt(suppFig5F2[,1], suppFig5F2[,2],tr=0.2,alpha=0.05,nboot=599,side=F)
ESfun(suppFig5F2[,1], suppFig5F2[,2]) # explanatory power
trimpb2(suppFig5F2[,1], suppFig5F2[,2],tr=0.2,alpha=0.05,nboot=2000,WIN=F,win=0.1)
```
## supplementary Figure 5 F3
Sust. UP-State Spindle PFC
```{r}
suppFig5F3 <- read.csv("suppFig5F3.txt ")
boxplot(suppFig5F3)
summary(suppFig5F3)
# Bootstrap-t Methods for Comparing trimmed means
yuenbt(suppFig5F3[,1], suppFig5F3[,2],tr=0.2,alpha=0.05,nboot=599,side=F)
ESfun(suppFig5F3[,1], suppFig5F3[,2]) # explanatory power
trimpb2(suppFig5F3[,1], suppFig5F3[,2],tr=0.2,alpha=0.05,nboot=2000,WIN=F,win=0.1)
```
### Figure 5 C1
Replays and Coordination to UP and Down States of the RTC and PFC
```{r}
data_fig5C1 <- read.csv("fig5C1.txt ")
boxplot(data_fig5C1[,1:4])
summary(data_fig5C1)
btrim(data_fig5C1[,1:4], tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,0,-1,0,0,0),c(0,1,-1,0,0,0),c(0,0,-1,1,0,0),c(0,0,-1,0,-1,0),c(0,0,-1,0,0,-1)) # matrix for group testing
linconb(data_fig5C1[,1:4],con=0,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### Figure 5 C2
Replays and Coordination to UP-States of the RTC and PFC
```{r}
data_fig5C2 <- read.csv("fig5C2.txt ")
data_fig5C2 <- data_fig5C2[, 1:6]
boxplot(data_fig5C2)
summary(data_fig5C2)
btrim(data_fig5C2, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,0,-1,0,0,0),c(0,1,-1,0,0,0),c(0,0,-1,1,0,0),c(0,0,-1,0,-1,0),c(0,0,-1,0,0,-1)) # matrix for group testing
linconb(data_fig5C2,con=0,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
### Figure 5 C3
Replays and Coordination from Down States of the RTC and PFC
```{r}
data_fig5C2 <- read.csv("fig5C3.txt ")
data_fig5C2 <- data_fig5C2[, 1:6]
boxplot(data_fig5C2)
summary(data_fig5C2)
btrim(data_fig5C2, tr=0.2, grp=NA, g=NULL, dp=NULL, nboot=599) # trimmed group mean anova with bootstrap-t
M = cbind(c(1,0,-1,0,0,0),c(0,1,-1,0,0,0),c(0,0,-1,1,0,0),c(0,0,-1,0,-1,0),c(0,0,-1,0,0,-1)) # matrix for group testing
linconb(data_fig5C2,con=0,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
## supplementary Figure 4 B1 and B2
uncategorized SWR from RTC
```{r}
suppFig3B_B <- read.csv("suppFig3B_B.txt ")
boxplot(suppFig3B_B)
summary(suppFig3B_B)
M = cbind(c(1,-1,0,0),c(0,0,1,-1)) # matrix for group testing
linconb(suppFig3B_B,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```
## supplementary Figure 4 C1 and C2
uncategorized SWR from RTC
```{r}
suppFig3C_C <- read.csv("suppFig3C_C.txt ")
boxplot(suppFig3C_C)
summary(suppFig3C_C)
M = cbind(c(1,-1,0,0),c(0,0,1,-1)) # matrix for group testing
linconb(suppFig3C_C,con=M,tr=0.2,alpha=0.05,nboot=599) # 20% trimmed group means with bootstrap-t method
```