---
title: "Figure 3 Analysis"
output: html_notebook
---
 

```{r}
library(tidyverse)
library(lme4)
library(lmerTest)
library(readxl)
setwd("D:/Labs/Levkowitz/Mikey/")
fig3 <- read_excel("Fig3_LifeactFRAP_individualsynapses_Formatted_Ron.xlsx")
fig3$synapse.ID <- gsub("'", "", fig3$synapse.ID)
fig3$synapse.ID <- gsub(".txt", "", fig3$synapse.ID)
fig3$fish.ID <- as.factor(fig3$fish.ID)
fig3$genotype <- factor(fig3$genotype, levels=unique(fig3$genotype))
ggplot(data=fig3, aes(x=time, y=fluorescence)) +
  geom_point(alpha=0.1) +
  geom_smooth(aes(group=synapse.ID, color=genotype), se=FALSE)
```
```{r}
ggplot(data=fig3, aes(x=time, y=fluorescence)) +
  geom_point(alpha=0.1) +
  geom_smooth(aes(group=synapse.ID, color=genotype), se=FALSE, method="lm")
m1.intercept <- lmer(fluorescence ~ genotype * time + (1|synapse.ID) + (1|fish.ID), 
                     data=fig3)
summary(m1.intercept)
```
# Effect size for time>50
```{r}
effsize::cohen.d(fluorescence~genotype, data=filter(fig3, time>50))
```

