Skip to content
Snippets Groups Projects
Commit b0be8cc9 authored by Xianzong Meng's avatar Xianzong Meng
Browse files

knite

parent 1156d9f8
No related branches found
No related tags found
No related merge requests found
......@@ -323,85 +323,14 @@ theme_classic() + facet_wrap(~ restriction, ncol = 2)
Fig_LE_approaching
ggsave('C:/Users/xiamen/Desktop/modified robogator/result figs/Fig_LE_approaching.svg', plot = Fig_LE_approaching, device = 'svg',dpi = 300)
```
## Fig4
## Fig4 A&B
```{r}
Fig4 <- ggarrange(Fig_LE_leaving, Fig_LE_approaching, ncols=2,labels=c('A','B'), common.legend=TRUE,legend="none")
Fig4
ggsave('C:/Users/xiamen/Desktop/modified robogator/result figs/Fig4.svg', plot = Fig4, device = 'svg',dpi = 300, width = 176, height = 140, units = "mm")
```
## below are ANOVA-based significant test (only in case p value is required)
## age effect, ANOVA-based significant test
```{r}
SD_foraging_sex_trials <- update(SD_foraging, . ~ . - sex:trials)
anova(SD_foraging, SD_foraging_sex_trials)
SD_foraging_sex_age <- update(SD_foraging, . ~ . - sex:age)
anova(SD_foraging, SD_foraging_sex_age)
SD_foraging_trials_age <- update(SD_foraging, . ~ . - trials:age)
anova(SD_foraging, SD_foraging_trials_age)
SD_foraging_sex <- lmer(foraging.score~ trials + age + trials:age + (1|rat_ID), df.SD_Rday1)
anova(SD_foraging, SD_foraging_sex)
SD_foraging_trials <- lmer(foraging.score~ sex + age + sex:age + (1|rat_ID), df.SD_Rday1)
anova(SD_foraging, SD_foraging_trials)
SD_foraging_age <- lmer(foraging.score~ sex + trials + sex:trials + (1|rat_ID), df.SD_Rday1)
anova(SD_foraging, SD_foraging_age)
emm_age_trials <- emmeans(SD_foraging, pairwise ~ age | trials)
emm_age_trials
emm_trials_age <- emmeans(SD_foraging, pairwise ~ trials | age)
emm_trials_age
```
## restriction effect, ANOVA-based significant test
```{r}
LE_foraging_sex_trials <- update(LE_foraging, . ~ . - sex:trials)
anova(LE_foraging, LE_foraging_sex_trials)
LE_foraging_sex_restriction <- update(LE_foraging, . ~ . - sex:restriction)
anova(LE_foraging, LE_foraging_sex_restriction)
LE_foraging_trials_restriction <- update(LE_foraging, . ~ . - trials:restriction)
anova(LE_foraging, LE_foraging_trials_restriction)
LE_foraging_sex <- lmer(foraging.score~ trials + restriction + trials:restriction + (1|rat_ID), df.LE_Rday1)
anova(LE_foraging, LE_foraging_sex)
LE_foraging_trials <- lmer(foraging.score~ sex + restriction + sex:restriction + (1|rat_ID), df.LE_Rday1)
anova(LE_foraging, LE_foraging_trials)
LE_foraging_restriction <- lmer(foraging.score~ sex + trials + sex:trials + (1|rat_ID), df.LE_Rday1)
anova(LE_foraging, LE_foraging_restriction)
emm_restriction_trials <- emmeans(LE_foraging, pairwise ~ restriction | trials)
emm_restriction_trials
emm_trials_restriction <- emmeans(LE_foraging, pairwise ~ trials | restriction)
emm_trials_restriction
```
## approaching posthoc
```{r}
approaching_emm_sex_restriction <- emmeans(mod.score_LE_approaching, pairwise ~ sex | restriction)
approaching_emm_sex_restriction
approaching_emm_restriction_sex <- emmeans(mod.score_LE_approaching, pairwise ~ restriction | sex)
approaching_emm_trials_sex
```
## approaching figure_restriction_sex
## Fig4 C&D approaching figure_restriction_sex
```{r}
fig4c <- ggplot(df.LE_Rday1_approaching_M, aes(x=trials, y=approaching.score, group=rat_ID)) +
geom_line(color="gray", alpha=0.2)+
......
This diff is collapsed.
codes/stasitic_files/figure-gfm/unnamed-chunk-22-1.png

9.11 KiB

codes/stasitic_files/figure-gfm/unnamed-chunk-22-2.png

8.75 KiB

codes/stasitic_files/figure-gfm/unnamed-chunk-22-3.png

16.6 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment