-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFigure2_ExtraAnalysis.Rmd
More file actions
148 lines (105 loc) · 4.68 KB
/
Copy pathFigure2_ExtraAnalysis.Rmd
File metadata and controls
148 lines (105 loc) · 4.68 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
---
title: "ExtraAnalysis_Figure2"
author: "Sarah Tennant & Matt Nolan"
date: "20/10/2021"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Plot coefficents for remaining groups (S, SA, PA, PSA)
_Plot coefficients for just speed cells_
6a. Plot coefficients for cells classified in Figure 1 as having a positive slope and in Figure 2 as having significant fit coefficients for speed only.
```{r}
data_coef_pos_S <- data_coef %>%
subset(group == "S") %>%
subset(lm_result == "Positive")
(pos_S_coef_plot <- standard_plot(data_coef_pos_S))
if (save_figures == 1) {
ggsave(file = "plots/CoefficientValues_PositiveScells.png", width = 3, height = 2.5)
}
```
6b. Plot coefficients for cells classified in Figure 1 as having a negative slope and in Figure 2 as having significant fit coefficients for speed only.
```{r}
data_coef_neg_S <- data_coef %>%
subset(group == "S") %>%
subset(lm_result == "Negative")
(neg_S_coef_plot <- standard_plot(data_coef_neg_S))
if (save_figures == 1) {
ggsave(file = "plots/CoefficientValues_NegativeScells.png", width = 3, height = 2.5)
}
```
_Plot coefficients for just acceleration cells_
6a. Plot coefficients for cells classified in Figure 1 as having a positive slope and in Figure 2 as having significant fit coefficients for acceleration only.
```{r}
data_coef_pos_A <- data_coef %>%
subset(group == "A") %>%
subset(lm_result == "Positive")
(pos_A_coef_plot <- standard_plot(data_coef_pos_A))
if (save_figures == 1) {
ggsave(file = "plots/CoefficientValues_PositiveAcells.png", width = 3, height = 2.5)
}
```
6b. Plot coefficients for cells classified in Figure 1 as having a negative slope and in Figure 2 as having significant fit coefficients for acceleration only.
```{r}
data_coef_neg_A <- data_coef %>%
subset(group == "A") %>%
subset(lm_result == "Negative")
(neg_A_coef_plot <- standard_plot(data_coef_neg_A))
if (save_figures == 1) {
ggsave(file = "plots/CoefficientValues_NegativeAcells.png", width = 3, height = 2.5)
}
```
_Plot coefficients for just position and acceleration cells_
6a. Plot coefficients for cells classified in Figure 1 as having a positive slope and in Figure 2 as having significant fit coefficients for position and acceleration.
```{r}
data_coef_pos_PA <- data_coef %>%
subset(group == "PA") %>%
subset(lm_result == "Positive")
(pos_PA_coef_plot <- standard_plot(data_coef_pos_PA))
if (save_figures == 1) {
ggsave(file = "plots/CoefficientValues_PositivePAcells.png", width = 3, height = 2.5)
}
```
6b. Plot coefficients for cells classified in Figure 1 as having a negative slope and in Figure 2 as having significant fit coefficients for position and acceleration
```{r}
data_coef_neg_PA <- data_coef %>%
subset(group == "PA") %>%
subset(lm_result == "Negative")
(neg_PA_coef_plot <- standard_plot(data_coef_neg_PA))
if (save_figures == 1) {
ggsave(file = "plots/CoefficientValues_NegativePAcells.png", width = 3, height = 2.5)
}
```
_Plot coefficients for just position and acceleration cells_
6a. Plot coefficients for cells classified in Figure 1 as having a positive slope and in Figure 2 as having significant fit coefficients for position and acceleration.
```{r}
data_coef_pos_PSA <- data_coef %>%
subset(group == "PSA") %>%
subset(lm_result == "Positive")
(pos_PSA_coef_plot <- standard_plot(data_coef_pos_PSA))
if (save_figures == 1) {
ggsave(file = "plots/CoefficientValues_PositivePSAcells.png", width = 3, height = 2.5)
}
```
6b. Plot coefficients for cells classified in Figure 1 as having a negative slope and in Figure 2 as having significant fit coefficients for speed only.
```{r}
data_coef_neg_PSA <- data_coef %>%
subset(group == "PSA") %>%
subset(lm_result == "Negative")
(neg_PSA_coef_plot <- standard_plot(data_coef_neg_PSA))
if (save_figures == 1) {
ggsave(file = "plots/CoefficientValues_NegativePSAcells.png", width = 3, height = 2.5)
}
```
## Save to csv file _this is for matching to plots from python_
```{r}
spatial_firing_save <- tibble(session_id = spatial_firing_save$session_id,
cluster_id = spatial_firing_save$cluster_id,
pos_stdcoef = as.character(spatial_firing_save$o_b_mod_coefs_pos),
speed_stdcoef = as.character(spatial_firing_save$o_b_mod_coefs_speed),
accel_stdcoef = as.character(spatial_firing_save$o_b_mod_coefs_accel),
final_model_o_b = as.character(spatial_firing_save$final_model_o_b),
lm_result_o_rewarded_b = as.character(spatial_firing_save$lm_group_b))
write.table(spatial_firing_save, "all_results_coefficients.txt", quote=FALSE, sep="\t")
```