Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

figure_1_S4.Rmd 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. ---
  2. title: "Spacek et al., 2021, Figure 1-Supplement 4"
  3. output: pdf_document
  4. ---
  5. ```{r setup, include=FALSE}
  6. knitr::opts_chunk$set(echo = TRUE)
  7. library(arm)
  8. library(lmerTest)
  9. library(tidyverse)
  10. source('get_data.R')
  11. ```
  12. ```{r read_data_1_S4_e-h, include=FALSE}
  13. tib = get_data("../csv/fig1S4mvi.csv")
  14. ```
  15. ```{r tidy_for_1_S4ef, include = FALSE}
  16. # Turn feedback into a binary variable
  17. tb <- tib %>% mutate(feedback = ifelse(opto == TRUE, 0, 1))
  18. ```
  19. # Figure 1-Supplement 4e
  20. ## Effect of suppression on firing rate - movies
  21. ```{r fit_model_1_S4e}
  22. # Random intercept, random slope for neurons,
  23. # random intercept for experiments
  24. lmer.1_S4e = lmer(rates ~ feedback + (1 + feedback | uid) + (1 | eid),
  25. data = tb %>% drop_na(rates))
  26. display(lmer.1_S4e)
  27. anova(lmer.1_S4e)
  28. ```
  29. ```{r get_predicted_average_effect_1_S4e, include=F}
  30. mSuppr = fixef(lmer.1_S4e)[1]
  31. diffRate = fixef(lmer.1_S4e)[2]
  32. mActive = fixef(lmer.1_S4e)[1] + diffRate
  33. ```
  34. Feedback: `r format(mActive, digits=2, nsmall=2)` spikes/s \newline
  35. Suppression: `r format(mSuppr, digits=2, nsmall=2)` spikes/s \newline
  36. n = `r nrow(tb %>% drop_na(rates) %>% count(uid))` neurons from `r nrow(tb %>% drop_na(rates) %>% count(mid))` mice
  37. \newpage
  38. # Figure 1-Supplement 4f
  39. ## Effect of suppression on burst ratio - movies
  40. ```{r fit_model_1_S4f}
  41. # Random intercept, random slope for neurons,
  42. # random intercept for experiments, nested in series
  43. lmer.1_S4f = lmer(burstratios ~ feedback + (1 + feedback | uid) + (1 | sid/eid),
  44. data = tb %>% drop_na(burstratios))
  45. display(lmer.1_S4f)
  46. anova(lmer.1_S4f)
  47. ```
  48. ```{r get_predicted_average_effect_1_S4f, include=F}
  49. mSuppr = fixef(lmer.1_S4f)[1]
  50. diffRate = fixef(lmer.1_S4f)[2]
  51. mActive = fixef(lmer.1_S4f)[1] + diffRate
  52. ```
  53. Feedback: `r format(mActive, digits=2, nsmall=2)` \newline
  54. Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
  55. n = `r nrow(tb %>% drop_na(burstratios) %>% count(uid))` neurons from `r nrow(tb %>% drop_na(burstratios) %>% count(mid))` mice
  56. \newpage
  57. # Figure 1-Supplement 4g
  58. ## Effect of suppression on sparseness - movies
  59. ```{r tidy_for_1_S4gh, include=FALSE}
  60. # 'Sparseness', and 'reliability' are not computed on a trial-by-trial basis. In the csv-file,
  61. # these two measures are therefore identical across trials, so we simply pull out the first trial of each neuron
  62. tbgh = tb %>% select(mid, sid, eid, uid, mseu, feedback, spars, rel) %>% distinct(mseu, feedback, .keep_all = TRUE)
  63. ```
  64. ```{r fit_model_1_S4g}
  65. # Random intercept, random slope for single neurons,
  66. # random intercept for series
  67. lmer.1_S4g = lmer(spars ~ feedback + (1 + feedback | uid) + (1 | sid),
  68. data = tbgh %>% drop_na(spars))
  69. display(lmer.1_S4g)
  70. anova(lmer.1_S4g)
  71. ```
  72. ```{r get_predicted_average_change_1_S4g, include=F}
  73. mSuppr = fixef(lmer.1_S4g)[1]
  74. mDiff = fixef(lmer.1_S4g)[2]
  75. mFeedback = fixef(lmer.1_S4g)[1] + mDiff
  76. ```
  77. Feedback: `r format(mFeedback, digits=2, nsmall=2)` \newline
  78. Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
  79. n = `r nrow(tbgh %>% drop_na(spars) %>% count(uid))` neurons from `r nrow(tbgh %>% drop_na(spars) %>% count(mid))` mice
  80. \newpage
  81. # Figure 1-Supplement 4h
  82. ## Effect of suppression on reliability - movies
  83. ```{r fit_model_1_S4h}
  84. # Random intercept, random slope for neurons,
  85. # random intercept for experiments, nested in mice
  86. lmer.1_S4h = lmer(rel ~ feedback + (1 +feedback | uid) + (1 | mid/eid),
  87. data = tbgh %>% drop_na(rel))
  88. display(lmer.1_S4h)
  89. anova(lmer.1_S4h)
  90. ```
  91. ```{r get_predicted_average_effect_1_S4h, include=F}
  92. mSuppr = fixef(lmer.1_S4h)[1]
  93. mDiff = fixef(lmer.1_S4h)[2]
  94. mFeedback = fixef(lmer.1_S4h)[1] + mDiff
  95. ```
  96. Feedback: `r format(mFeedback, digits=2, nsmall=2)` \newline
  97. Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
  98. n = `r nrow(tbgh %>% drop_na(rel) %>% count(uid))` neurons from `r nrow(tbgh %>% drop_na(rel) %>% count(mid))` mice
  99. ```{r read_data_1_S4_l-o, include=FALSE}
  100. tib = get_data("../csv/fig1S4grt.csv")
  101. ```
  102. ```{r tidy_for_1_S4_l-o, include = FALSE}
  103. # Turn feedback into a binary variable
  104. tb <- tib %>% mutate(feedback = ifelse(opto == TRUE, 0, 1))
  105. ```
  106. \newpage
  107. # Figure 1-Supplement 4l
  108. ## Effect of suppression on firing rate - gratings
  109. ```{r fit_model_1_S4l}
  110. # Random intercept, random slope for neurons,
  111. # random intercept for experiments nested in series
  112. lmer.1_S4l = lmer(rates ~ feedback + (1 + feedback | uid) + (1 | sid/eid),
  113. data = tb %>% drop_na(rates))
  114. display(lmer.1_S4l)
  115. anova(lmer.1_S4l)
  116. ```
  117. ```{r get_predicted_average_effect_1_S4l, include=F}
  118. mSuppr = fixef(lmer.1_S4l)[1]
  119. diffRate = fixef(lmer.1_S4l)[2]
  120. mActive = fixef(lmer.1_S4l)[1] + diffRate
  121. ```
  122. Feedback: `r format(mActive, digits=2, nsmall=2)` spikes/s \newline
  123. Suppression: `r format(mSuppr, digits=2, nsmall=2)` spikes/s \newline
  124. n = `r nrow(tb %>% drop_na(rates) %>% count(uid))` neurons from `r nrow(tb %>% drop_na(rates) %>% count(mid))` mice
  125. \newpage
  126. # Figure 1-Supplement 4m
  127. ## Effect of suppression on burst ratio - gratings
  128. ```{r fit_model_1_S4m}
  129. # Random intercept, random slope for neurons,
  130. # random intercept for experiments
  131. lmer.1_S4m = lmer(burstratios ~ feedback + (1 + feedback | uid) + (1 | eid),
  132. data = tb %>% drop_na(burstratios))
  133. display(lmer.1_S4m)
  134. anova(lmer.1_S4m)
  135. ```
  136. ```{r predicted_average_effect_1_S4m, include=F}
  137. mSuppr = fixef(lmer.1_S4m)[1]
  138. diffRate = fixef(lmer.1_S4m)[2]
  139. mActive = fixef(lmer.1_S4m)[1] + diffRate
  140. ```
  141. Feedback: `r format(mActive, digits=2, nsmall=2)` \newline
  142. Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
  143. n = `r nrow(tb %>% drop_na(burstratios) %>% count(uid))` neurons from `r nrow(tb %>% drop_na(burstratios) %>% count(mid))` mice
  144. \newpage
  145. # Figure 1-Supplement 4n
  146. ## Effect of suppression on F1/F0 - gratings
  147. ```{r tidy_for_1_S4no, include=FALSE}
  148. # 'F1/F0 ratio' is not computed on a trial-by-trial basis. In the csv-file,
  149. # this measure is therefore identical across trials, so we simply pull out the first trial of each neuron
  150. tbn = tb %>% select(mid, sid, eid, uid, mseu, feedback, f1f0) %>% distinct(mseu, feedback, .keep_all = TRUE)
  151. ```
  152. ```{r fit_model_1_S4n}
  153. # Random intercept for neurons,
  154. # random intercept for experiments, nested in series
  155. lmer.1_S4n = lmer(f1f0 ~ feedback + (1 | uid) + (1 | sid/eid),
  156. data = tbn %>% drop_na(f1f0))
  157. display(lmer.1_S4n)
  158. anova(lmer.1_S4n)
  159. ```
  160. ```{r get_predicted_average_effect_1_S4n, include=F}
  161. mSuppr = fixef(lmer.1_S4n)[1]
  162. mDiff = fixef(lmer.1_S4n)[2]
  163. mFeedback = fixef(lmer.1_S4n)[1] + mDiff
  164. ```
  165. Feedback: `r format(mFeedback, digits=2, nsmall=2)` \newline
  166. Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
  167. n = `r nrow(tbn %>% drop_na(f1f0) %>% count(uid))` neurons from `r nrow(tbn %>% drop_na(f1f0) %>% count(mid))` mice