MSN electrophysiology data analysis

Analysis of the ephys data from CON and MIA mice treated with PIC at E9. Recordings were performed on D1TdTom+ (D1R) and D1TdTom- (D2R) MSNs in the ventral striatum.

Paired Pulse Ratio

Repeated measures two-way ANOVA

PPR %>% filter(ms == "400") %>% group_by(Type, Group) %>% summarise(cells = n(), mouse = length(unique(ID)), litter = length(unique(Litter)))
## `summarise()` has grouped output by 'Type'. You can override using the `.groups` argument.
## # A tibble: 4 x 5
## # Groups:   Type [2]
##   Type  Group cells mouse litter
##   <chr> <chr> <int> <int>  <int>
## 1 D1R   CON      14     8      5
## 2 D1R   MIA      11     5      6
## 3 D2R   CON      13     5      5
## 4 D2R   MIA      11     5      5
message("Tom+ (D1R)")
## Tom+ (D1R)
anova(lm(ppr~Group*ms+ID, data = D1R))
## Analysis of Variance Table
## 
## Response: ppr
##            Df Sum Sq Mean Sq F value Pr(>F)    
## Group       1   0.13   0.126    0.99  0.323    
## ms          1   0.52   0.516    4.03  0.047 *  
## ID         11   9.79   0.890    6.96  8e-09 ***
## Group:ms    1   0.00   0.002    0.01  0.913    
## Residuals 110  14.07   0.128                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
message("Tom- (D2R)")
## Tom- (D2R)
anova(lm(ppr~Group*ms+ID, data = D2R))
## Analysis of Variance Table
## 
## Response: ppr
##            Df Sum Sq Mean Sq F value  Pr(>F)    
## Group       1   2.73   2.730   14.50 0.00023 ***
## ms          1   1.37   1.373    7.30 0.00802 ** 
## ID          8   2.19   0.274    1.46 0.18210    
## Group:ms    1   0.05   0.045    0.24 0.62479    
## Residuals 108  20.33   0.188                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

sEPSC Frequency and Amplitude

T-test

data %>% group_by(Type, Group) %>% summarise(cells = n(), mouse = length(unique(ID)), litter = length(unique(Litter)))
## `summarise()` has grouped output by 'Type'. You can override using the `.groups` argument.
## # A tibble: 4 x 5
## # Groups:   Type [2]
##   Type  Group cells mouse litter
##   <chr> <chr> <int> <int>  <int>
## 1 D1R   CON      11     8      5
## 2 D1R   MIA      10     4      3
## 3 D2R   CON      10     6      4
## 4 D2R   MIA      13     6      4
message("Analysis of sEPSC Frequency")
## Analysis of sEPSC Frequency
table(D1R$Group, dnn = "Number of D1R Cells")
## Number of D1R Cells
## CON MIA 
##  11  10
table(D2R$Group, dnn = "Number of D2R Cells")
## Number of D2R Cells
## CON MIA 
##  10  13
data %>% group_by(Type, Group) %>% shapiro_test(sFreq)
## # A tibble: 4 x 5
##   Group Type  variable statistic     p
##   <chr> <chr> <chr>        <dbl> <dbl>
## 1 CON   D1R   sFreq        0.916 0.284
## 2 MIA   D1R   sFreq        0.952 0.697
## 3 CON   D2R   sFreq        0.940 0.556
## 4 MIA   D2R   sFreq        0.959 0.742
t.test(D1R$sFreq ~ D1R$Group)
## 
##  Welch Two Sample t-test
## 
## data:  D1R$sFreq by D1R$Group
## t = 0.4, df = 19, p-value = 0.7
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.71  1.09
## sample estimates:
## mean in group CON mean in group MIA 
##              3.68              3.50
t.test(D2R$sFreq ~ D2R$Group)
## 
##  Welch Two Sample t-test
## 
## data:  D2R$sFreq by D2R$Group
## t = 2, df = 16, p-value = 0.03
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.087 1.939
## sample estimates:
## mean in group CON mean in group MIA 
##              3.72              2.71
message("Analysis of sEPSC Amplitude")
## Analysis of sEPSC Amplitude
data %>% group_by(Type, Group) %>% shapiro_test(sAmp)
## # A tibble: 4 x 5
##   Group Type  variable statistic      p
##   <chr> <chr> <chr>        <dbl>  <dbl>
## 1 CON   D1R   sAmp         0.922 0.333 
## 2 MIA   D1R   sAmp         0.850 0.0580
## 3 CON   D2R   sAmp         0.864 0.0847
## 4 MIA   D2R   sAmp         0.919 0.242
t.test(D1R$sAmp ~ D1R$Group)
## 
##  Welch Two Sample t-test
## 
## data:  D1R$sAmp by D1R$Group
## t = -1, df = 15, p-value = 0.2
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -3.56  0.84
## sample estimates:
## mean in group CON mean in group MIA 
##              15.5              16.9
t.test(D2R$sAmp ~ D2R$Group)
## 
##  Welch Two Sample t-test
## 
## data:  D2R$sAmp by D2R$Group
## t = 1, df = 17, p-value = 0.2
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -1.25  4.90
## sample estimates:
## mean in group CON mean in group MIA 
##              16.7              14.9

KS Test of Cumulative Distrubtion

message("KS Test comparing the control and MIA D1R sEPSC frequency distribution")
## KS Test comparing the control and MIA D1R sEPSC frequency distribution
ks.test(D1R[D1R$Group=="CON",]$probability,D1R[D1R$Group=="MIA",]$probability)
## Warning in ks.test(D1R[D1R$Group == "CON", ]$probability, D1R[D1R$Group == :
## cannot compute exact p-value with ties
## 
##  Two-sample Kolmogorov-Smirnov test
## 
## data:  D1R[D1R$Group == "CON", ]$probability and D1R[D1R$Group == "MIA", ]$probability
## D = 0.1, p-value = 1
## alternative hypothesis: two-sided
message("KS Test comparing the control and MIA D2R sEPSC frequency distribution")
## KS Test comparing the control and MIA D2R sEPSC frequency distribution
ks.test(D2R[D2R$Group=="CON",]$probability,D2R[D2R$Group=="MIA",]$probability)
## Warning in ks.test(D2R[D2R$Group == "CON", ]$probability, D2R[D2R$Group == :
## cannot compute exact p-value with ties
## 
##  Two-sample Kolmogorov-Smirnov test
## 
## data:  D2R[D2R$Group == "CON", ]$probability and D2R[D2R$Group == "MIA", ]$probability
## D = 0.4, p-value = 0.004
## alternative hypothesis: two-sided
rm(list = ls())

mESPC Frequency and Amplitude

T-test

data %>% group_by(Type, Group) %>% summarise(cells = n(), mouse = length(unique(ID)))
## `summarise()` has grouped output by 'Type'. You can override using the `.groups` argument.
## # A tibble: 2 x 4
## # Groups:   Type [1]
##   Type  Group cells mouse
##   <chr> <chr> <int> <int>
## 1 D2R   CON      16     3
## 2 D2R   MIA      12     3
message("Analysis of mEPSC Frequency")
## Analysis of mEPSC Frequency
table(data$Group, dnn = "Number of D2R Cells")
## Number of D2R Cells
## CON MIA 
##  16  12
data %>% group_by(Group) %>% shapiro_test(mFreq)
## # A tibble: 2 x 4
##   Group variable statistic      p
##   <chr> <chr>        <dbl>  <dbl>
## 1 CON   mFreq        0.944 0.396 
## 2 MIA   mFreq        0.858 0.0464
t.test(data$mFreq ~ data$Group)
## 
##  Welch Two Sample t-test
## 
## data:  data$mFreq by data$Group
## t = 3, df = 25, p-value = 0.01
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.197 1.357
## sample estimates:
## mean in group CON mean in group MIA 
##              3.15              2.37
message("Analysis of mEPSC Amplitude")
## Analysis of mEPSC Amplitude
data %>% group_by(Group) %>% shapiro_test(mAmp)
## # A tibble: 2 x 4
##   Group variable statistic      p
##   <chr> <chr>        <dbl>  <dbl>
## 1 CON   mAmp         0.966 0.764 
## 2 MIA   mAmp         0.867 0.0594
t.test(data$mAmp ~ data$Group)
## 
##  Welch Two Sample t-test
## 
## data:  data$mAmp by data$Group
## t = 1, df = 24, p-value = 0.2
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.823  4.225
## sample estimates:
## mean in group CON mean in group MIA 
##              15.1              13.4

KS Test

message("KS Test comparing the control and MIA D2R mEPSC frequency distribution")
## KS Test comparing the control and MIA D2R mEPSC frequency distribution
ks.test(cumlFreq[cumlFreq$Group=="CON",]$probability,cumlFreq[cumlFreq$Group=="MIA",]$probability)
## Warning in ks.test(cumlFreq[cumlFreq$Group == "CON", ]$probability,
## cumlFreq[cumlFreq$Group == : cannot compute exact p-value with ties
## 
##  Two-sample Kolmogorov-Smirnov test
## 
## data:  cumlFreq[cumlFreq$Group == "CON", ]$probability and cumlFreq[cumlFreq$Group == "MIA", ]$probability
## D = 0.4, p-value = 0.008
## alternative hypothesis: two-sided
rm(list = ls())
sessionInfo()
## R version 4.0.3 (2020-10-10)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur 10.16
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] rstatix_0.7.0   forcats_0.5.1   stringr_1.4.0   dplyr_1.0.7    
##  [5] purrr_0.3.4     readr_1.4.0     tidyr_1.1.3     tibble_3.1.2   
##  [9] tidyverse_1.3.1 cowplot_1.1.1   ggplot2_3.3.5  
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.7        lattice_0.20-44   lubridate_1.7.10  assertthat_0.2.1 
##  [5] digest_0.6.27     utf8_1.2.1        R6_2.5.0          cellranger_1.1.0 
##  [9] backports_1.2.1   reprex_2.0.0      evaluate_0.14     highr_0.9        
## [13] httr_1.4.2        pillar_1.6.1      rlang_0.4.11      curl_4.3.2       
## [17] readxl_1.3.1      rstudioapi_0.13   data.table_1.14.0 car_3.0-11       
## [21] jquerylib_0.1.4   Matrix_1.3-4      rmarkdown_2.9     splines_4.0.3    
## [25] labeling_0.4.2    foreign_0.8-81    munsell_0.5.0     broom_0.7.8      
## [29] compiler_4.0.3    modelr_0.1.8      xfun_0.24         pkgconfig_2.0.3  
## [33] mgcv_1.8-36       htmltools_0.5.1.1 tidyselect_1.1.1  rio_0.5.27       
## [37] fansi_0.5.0       crayon_1.4.1      dbplyr_2.1.1      withr_2.4.2      
## [41] grid_4.0.3        nlme_3.1-152      jsonlite_1.7.2    gtable_0.3.0     
## [45] lifecycle_1.0.0   DBI_1.1.1         magrittr_2.0.1    scales_1.1.1     
## [49] zip_2.2.0         carData_3.0-4     cli_3.0.0         stringi_1.6.2    
## [53] farver_2.1.0      fs_1.5.0          xml2_1.3.2        bslib_0.2.5.1    
## [57] ellipsis_0.3.2    generics_0.1.0    vctrs_0.3.8       openxlsx_4.2.4   
## [61] tools_4.0.3       glue_1.4.2        hms_1.1.0         abind_1.4-5      
## [65] yaml_2.2.1        colorspace_2.0-2  rvest_1.0.0       knitr_1.33       
## [69] haven_2.4.1       sass_0.4.0