123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- ---
- title: "Spacek et al., 2021, Figure 1-Supplement 4"
- output: pdf_document
- ---
- ```{r setup, include=FALSE}
- knitr::opts_chunk$set(echo = TRUE)
- library(arm)
- library(lmerTest)
- library(tidyverse)
- source('get_data.R')
- ```
- ```{r read_data_1_S4_e-h, include=FALSE}
- tib = get_data("../csv/fig1S4mvi.csv")
- ```
- ```{r tidy_for_1_S4ef, include = FALSE}
- # Turn feedback into a binary variable
- tb <- tib %>% mutate(feedback = ifelse(opto == TRUE, 0, 1))
- ```
- # Figure 1-Supplement 4e
- ## Effect of suppression on firing rate - movies
- ```{r fit_model_1_S4e}
- # Random intercept, random slope for neurons,
- # random intercept for experiments
- lmer.1_S4e = lmer(rates ~ feedback + (1 + feedback | uid) + (1 | eid),
- data = tb %>% drop_na(rates))
- display(lmer.1_S4e)
- anova(lmer.1_S4e)
- ```
- ```{r get_predicted_average_effect_1_S4e, include=F}
- mSuppr = fixef(lmer.1_S4e)[1]
- diffRate = fixef(lmer.1_S4e)[2]
- mActive = fixef(lmer.1_S4e)[1] + diffRate
- ```
- Feedback: `r format(mActive, digits=2, nsmall=2)` spikes/s \newline
- Suppression: `r format(mSuppr, digits=2, nsmall=2)` spikes/s \newline
- n = `r nrow(tb %>% drop_na(rates) %>% count(uid))` neurons from `r nrow(tb %>% drop_na(rates) %>% count(mid))` mice
- \newpage
- # Figure 1-Supplement 4f
- ## Effect of suppression on burst ratio - movies
- ```{r fit_model_1_S4f}
- # Random intercept, random slope for neurons,
- # random intercept for experiments, nested in series
- lmer.1_S4f = lmer(burstratios ~ feedback + (1 + feedback | uid) + (1 | sid/eid),
- data = tb %>% drop_na(burstratios))
- display(lmer.1_S4f)
- anova(lmer.1_S4f)
- ```
- ```{r get_predicted_average_effect_1_S4f, include=F}
- mSuppr = fixef(lmer.1_S4f)[1]
- diffRate = fixef(lmer.1_S4f)[2]
- mActive = fixef(lmer.1_S4f)[1] + diffRate
- ```
- Feedback: `r format(mActive, digits=2, nsmall=2)` \newline
- Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
- n = `r nrow(tb %>% drop_na(burstratios) %>% count(uid))` neurons from `r nrow(tb %>% drop_na(burstratios) %>% count(mid))` mice
- \newpage
- # Figure 1-Supplement 4g
- ## Effect of suppression on sparseness - movies
- ```{r tidy_for_1_S4gh, include=FALSE}
- # 'Sparseness', and 'reliability' are not computed on a trial-by-trial basis. In the csv-file,
- # these two measures are therefore identical across trials, so we simply pull out the first trial of each neuron
- tbgh = tb %>% select(mid, sid, eid, uid, mseu, feedback, spars, rel) %>% distinct(mseu, feedback, .keep_all = TRUE)
- ```
- ```{r fit_model_1_S4g}
- # Random intercept, random slope for single neurons,
- # random intercept for series
- lmer.1_S4g = lmer(spars ~ feedback + (1 + feedback | uid) + (1 | sid),
- data = tbgh %>% drop_na(spars))
- display(lmer.1_S4g)
- anova(lmer.1_S4g)
- ```
- ```{r get_predicted_average_change_1_S4g, include=F}
- mSuppr = fixef(lmer.1_S4g)[1]
- mDiff = fixef(lmer.1_S4g)[2]
- mFeedback = fixef(lmer.1_S4g)[1] + mDiff
- ```
- Feedback: `r format(mFeedback, digits=2, nsmall=2)` \newline
- Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
- n = `r nrow(tbgh %>% drop_na(spars) %>% count(uid))` neurons from `r nrow(tbgh %>% drop_na(spars) %>% count(mid))` mice
- \newpage
- # Figure 1-Supplement 4h
- ## Effect of suppression on reliability - movies
- ```{r fit_model_1_S4h}
- # Random intercept, random slope for neurons,
- # random intercept for experiments, nested in mice
- lmer.1_S4h = lmer(rel ~ feedback + (1 +feedback | uid) + (1 | mid/eid),
- data = tbgh %>% drop_na(rel))
- display(lmer.1_S4h)
- anova(lmer.1_S4h)
- ```
- ```{r get_predicted_average_effect_1_S4h, include=F}
- mSuppr = fixef(lmer.1_S4h)[1]
- mDiff = fixef(lmer.1_S4h)[2]
- mFeedback = fixef(lmer.1_S4h)[1] + mDiff
- ```
- Feedback: `r format(mFeedback, digits=2, nsmall=2)` \newline
- Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
- n = `r nrow(tbgh %>% drop_na(rel) %>% count(uid))` neurons from `r nrow(tbgh %>% drop_na(rel) %>% count(mid))` mice
- ```{r read_data_1_S4_l-o, include=FALSE}
- tib = get_data("../csv/fig1S4grt.csv")
- ```
- ```{r tidy_for_1_S4_l-o, include = FALSE}
- # Turn feedback into a binary variable
- tb <- tib %>% mutate(feedback = ifelse(opto == TRUE, 0, 1))
- ```
- \newpage
- # Figure 1-Supplement 4l
- ## Effect of suppression on firing rate - gratings
- ```{r fit_model_1_S4l}
- # Random intercept, random slope for neurons,
- # random intercept for experiments nested in series
- lmer.1_S4l = lmer(rates ~ feedback + (1 + feedback | uid) + (1 | sid/eid),
- data = tb %>% drop_na(rates))
- display(lmer.1_S4l)
- anova(lmer.1_S4l)
- ```
- ```{r get_predicted_average_effect_1_S4l, include=F}
- mSuppr = fixef(lmer.1_S4l)[1]
- diffRate = fixef(lmer.1_S4l)[2]
- mActive = fixef(lmer.1_S4l)[1] + diffRate
- ```
- Feedback: `r format(mActive, digits=2, nsmall=2)` spikes/s \newline
- Suppression: `r format(mSuppr, digits=2, nsmall=2)` spikes/s \newline
- n = `r nrow(tb %>% drop_na(rates) %>% count(uid))` neurons from `r nrow(tb %>% drop_na(rates) %>% count(mid))` mice
- \newpage
- # Figure 1-Supplement 4m
- ## Effect of suppression on burst ratio - gratings
- ```{r fit_model_1_S4m}
- # Random intercept, random slope for neurons,
- # random intercept for experiments
- lmer.1_S4m = lmer(burstratios ~ feedback + (1 + feedback | uid) + (1 | eid),
- data = tb %>% drop_na(burstratios))
- display(lmer.1_S4m)
- anova(lmer.1_S4m)
- ```
- ```{r predicted_average_effect_1_S4m, include=F}
- mSuppr = fixef(lmer.1_S4m)[1]
- diffRate = fixef(lmer.1_S4m)[2]
- mActive = fixef(lmer.1_S4m)[1] + diffRate
- ```
- Feedback: `r format(mActive, digits=2, nsmall=2)` \newline
- Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
- n = `r nrow(tb %>% drop_na(burstratios) %>% count(uid))` neurons from `r nrow(tb %>% drop_na(burstratios) %>% count(mid))` mice
- \newpage
- # Figure 1-Supplement 4n
- ## Effect of suppression on F1/F0 - gratings
- ```{r tidy_for_1_S4no, include=FALSE}
- # 'F1/F0 ratio' is not computed on a trial-by-trial basis. In the csv-file,
- # this measure is therefore identical across trials, so we simply pull out the first trial of each neuron
- tbn = tb %>% select(mid, sid, eid, uid, mseu, feedback, f1f0) %>% distinct(mseu, feedback, .keep_all = TRUE)
- ```
- ```{r fit_model_1_S4n}
- # Random intercept for neurons,
- # random intercept for experiments, nested in series
- lmer.1_S4n = lmer(f1f0 ~ feedback + (1 | uid) + (1 | sid/eid),
- data = tbn %>% drop_na(f1f0))
- display(lmer.1_S4n)
- anova(lmer.1_S4n)
- ```
- ```{r get_predicted_average_effect_1_S4n, include=F}
- mSuppr = fixef(lmer.1_S4n)[1]
- mDiff = fixef(lmer.1_S4n)[2]
- mFeedback = fixef(lmer.1_S4n)[1] + mDiff
- ```
- Feedback: `r format(mFeedback, digits=2, nsmall=2)` \newline
- Suppression: `r format(mSuppr, digits=2, nsmall=2)` \newline
- n = `r nrow(tbn %>% drop_na(f1f0) %>% count(uid))` neurons from `r nrow(tbn %>% drop_na(f1f0) %>% count(mid))` mice
|