Table of Contents
- Importing Data
- Analysis of experiment metrics
- Heatmap
- Heatmap_reversal
- Strategies
- OLD Graphs
- UPDATED Graphs
- Probe Trial Graphs
- Layout Test
- Arena Quadrant Problem
- t-Tests
- Logistic regression
- Strategy overview plot
- Visualization results log.reg
- Thresholded Logistic regression
- Thresholded Visualization results log.reg
- Publication ready Visualization results log.reg
- Publication ready Plots
- Statistics
- Percentage
- References
Importing Data
Here a multicore CPU cluster is opened to reduce experiment reading times. This cluster is closed after the execution of the code.
cluster = parallel::makeCluster(rep("localhost", parallel::detectCores()), type = "PSOCK")
experiment = Rtrack::read_experiment("Experiment_description2.xlsx", format = "Excel")#, cluster = cluster)
parallel::stopCluster(cluster)
Analysis of experiment metrics
These metrics can be compared and extracted from the pure track files.
experiment$summary.variables
[1] "path.length" "mean.velocity"
[3] "sd.velocity" "total.time"
[5] "latency.to.goal" "goal.crossings"
[7] "old.goal.crossings" "coverage"
[9] "mean.d.centroid" "mean.d.goal"
[11] "mean.d.old.goal" "mean.d.origin"
[13] "sd.d.centroid" "sd.d.goal"
[15] "sd.d.old.goal" "sd.d.origin"
[17] "centroid.goal.displacement" "centroid.old.goal.displacement"
[19] "mean.initial.heading.error" "initial.trajectory.error"
[21] "initial.reversal.error" "turning"
[23] "turning.absolute" "efficiency"
[25] "roaming.entropy" "time.in.zone.pool"
[27] "time.in.zone.wall" "time.in.zone.far.wall"
[29] "time.in.zone.annulus" "time.in.zone.goal"
[31] "time.in.zone.old.goal" "time.in.zone.n.quadrant"
[33] "time.in.zone.e.quadrant" "time.in.zone.s.quadrant"
[35] "time.in.zone.w.quadrant"
par(mfrow = c(2, 2))
Rtrack::plot_variable("path.length", experiment = experiment, factor = "Strain", exclude.probe = TRUE,lwd = 2)
Rtrack::plot_variable("path.length", experiment = experiment, factor = "Age_group", exclude.probe = TRUE,lwd = 2)
Rtrack::plot_variable("path.length", experiment = experiment, factor = "Housing", exclude.probe = TRUE,lwd = 2)
Rtrack::plot_variable("path.length", experiment = experiment, factor = "All", exclude.probe = TRUE,lwd = 2)
Note that the probe trials have been omitted from these plots.
Heatmap
wt.metrics = experiment$metrics[experiment$factors$Strain == "WT" &
(experiment$factors$`_Day` == 1 | experiment$factors$`_Day` == 2 | experiment$factors$`_Day` == 3 | experiment$factors$`_Day` == 4|
experiment$factors$`_Day` == 5| experiment$factors$`_Day` == 6)]
dTg.metrics = experiment$metrics[experiment$factors$Strain == "dTg" &
(experiment$factors$`_Day` == 1 | experiment$factors$`_Day` == 2 | experiment$factors$`_Day` == 3 | experiment$factors$`_Day` == 4| experiment$factors$`_Day` == 5| experiment$factors$`_Day` == 6)]
APP.metrics = experiment$metrics[experiment$factors$Strain == "APPswe" &
(experiment$factors$`_Day` == 1 | experiment$factors$`_Day` == 2 | experiment$factors$`_Day` == 3 | experiment$factors$`_Day` == 4| experiment$factors$`_Day` == 5| experiment$factors$`_Day` == 6)]
PS1.metrics = experiment$metrics[experiment$factors$Strain == "PS1dE9" &
(experiment$factors$`_Day` == 1 | experiment$factors$`_Day` == 2 | experiment$factors$`_Day` == 3 | experiment$factors$`_Day` == 4| experiment$factors$`_Day` == 5| experiment$factors$`_Day` == 6)]
par(mfrow = c(2, 2))
Rtrack::plot_density(wt.metrics, title = "wt Heatmap",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTg.metrics, title = "dTg Heatmap",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(APP.metrics, title = "APPswe Heatmap",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(PS1.metrics, title = "PS1dE9 Heatmap",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Heatmap_reversal
wtr.metrics = experiment$metrics[experiment$factors$Strain == "WT" &
(experiment$factors$`_Day` == 7 | experiment$factors$`_Day` == 8 | experiment$factors$`_Day` == 9 | experiment$factors$`_Day` == 10)]
dTgr.metrics = experiment$metrics[experiment$factors$Strain == "dTg" &
(experiment$factors$`_Day` == 7 | experiment$factors$`_Day` == 8 | experiment$factors$`_Day` == 9 | experiment$factors$`_Day` == 10)]
APPr.metrics = experiment$metrics[experiment$factors$Strain == "APPswe" &
(experiment$factors$`_Day` ==7 | experiment$factors$`_Day` == 8 | experiment$factors$`_Day` == 9 | experiment$factors$`_Day` == 10)]
PS1r.metrics = experiment$metrics[experiment$factors$Strain == "PS1dE9" &
(experiment$factors$`_Day` == 7 | experiment$factors$`_Day` == 8 | experiment$factors$`_Day` == 9 | experiment$factors$`_Day` == 10)]
par(mfrow = c(2, 2))
Rtrack::plot_density(wtr.metrics, title = "WT_reversal Heatmap",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTgr.metrics, title = "dTg_reversal Heatmap",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(APPr.metrics, title = "APPswe_reversal Heatmap",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(PS1r.metrics, title = "PS1dE9_reversal Heatmap",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Strategies
Calling strategies
strategies = Rtrack::call_strategy(experiment$metrics)
Thresholding strategies
limits called strategies to those, where confidence is greater than 40%
dim(Rtrack::threshold_strategies(strategies, 0.4)$calls)
[1] 4203 12
Plotting strategies of all age groups combined
par(mfrow = c(2, 2))
Rtrack::plot_strategies(strategies, experiment = experiment, factor = "Strain",
exclude.probe = TRUE)
Plotting thresholded strategies of all age groups combined
par(mfrow = c(2, 2))
Rtrack::plot_strategies(Rtrack::threshold_strategies(strategies, 0.4), experiment = experiment,
factor = "Strain", exclude.probe = TRUE)
Saving the results
Here we export the results of the analyzed Track Files into a data.frame, to analyse them further.
results = Rtrack::export_results(experiment)
datatable(results, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) )
OLD Graphs
Plotting with ggplot2
library(ggplot2)
library(readxl)
Results=read_excel("Results3.xlsx", col_types=c("text","text","text","text","text","text","logical","numeric","text","text","text","numeric","text","numeric","text","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric"))
ggplot(Results, aes(x=`_Day`,y=path.length,color=factor(Strain)))+geom_jitter()
Results
# A tibble: 5,960 x 60
Track_ID `_TargetID` `_Day` `_Trial` `_Arena` Condition Probe Trial Strain
<chr> <chr> <chr> <chr> <chr> <chr> <lgl> <dbl> <chr>
1 Track_4 60-911 1 1 Arena_SW.t~ WT_STD FALSE 4 WT
2 Track_8 60-293 1 1 Arena_SW.t~ WT_STD FALSE 8 WT
3 Track_9 60-296 1 1 Arena_SW.t~ WT_STD FALSE 9 WT
4 Track_10 60-333 1 1 Arena_SW.t~ dTg_STD FALSE 10 dTg
5 Track_14 60-911 1 2 Arena_SW.t~ WT_STD FALSE 14 WT
6 Track_18 60-293 1 2 Arena_SW.t~ WT_STD FALSE 18 WT
7 Track_19 60-296 1 2 Arena_SW.t~ WT_STD FALSE 19 WT
8 Track_20 60-333 1 2 Arena_SW.t~ dTg_STD FALSE 20 dTg
9 Track_24 60-911 1 3 Arena_SW.t~ WT_STD FALSE 24 WT
10 Track_28 60-293 1 3 Arena_SW.t~ WT_STD FALSE 28 WT
# ... with 5,950 more rows, and 51 more variables: Housing <chr>,
# Age_group <chr>, Age_months <dbl>, All <chr>, strategy <dbl>, name <chr>,
# confidence <dbl>, 1 <dbl>, 2 <dbl>, 3 <dbl>, 4 <dbl>, 5 <dbl>, 6 <dbl>,
# 7 <dbl>, 8 <dbl>, 9 <dbl>, path.length <dbl>, mean.velocity <dbl>,
# sd.velocity <dbl>, total.time <dbl>, latency.to.goal <dbl>,
# goal.crossings <dbl>, old.goal.crossings <dbl>, coverage <dbl>,
# mean.d.centroid <dbl>, mean.d.goal <dbl>, mean.d.old.goal <dbl>, ...
CAREFUL!!! The graphs below still include the probe trials (day 7 trial 1). To remove them add: Probe==‘FALSE’ to filter
Path Length Graphs
WT_STD=filter(Results, Strain=='WT'&Housing=='STD')
dTg_STD=filter(Results, Strain=='dTg'&Housing=='STD')
APP_STD=filter(Results, Strain=='APPswe'&Housing=='STD')
PS_STD=filter(Results, Strain=='PS1dE9'&Housing=='STD')
WT_ENR=filter(Results, Strain=='WT'&Housing=='ENR')
dTg_ENR=filter(Results, Strain=='dTg'&Housing=='ENR')
APP_ENR=filter(Results, Strain=='APPswe'&Housing=='ENR')
PS_ENR=filter(Results, Strain=='PS1dE9'&Housing=='ENR')
par(mfrow = c(2, 4))
WT_STD %>%
mutate(WT_STD, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length WT STD")+scale_fill_jco()
dTg_STD %>%
mutate(dTg_STD, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length dTg STD")+scale_fill_jco()
APP_STD %>%
mutate(APP_STD, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length APPswe1 STD")+scale_fill_jco()
PS_STD %>%
mutate(PS_STD, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length PS1dE9 STD")+scale_fill_jco()
WT_ENR %>%
mutate(WT_ENR, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length WT ENR")+scale_fill_jco()
dTg_ENR %>%
mutate(dTg_ENR, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length dTg ENR")+scale_fill_jco()
APP_ENR %>%
mutate(APP_ENR, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length APPswe1 ENR")+scale_fill_jco()
PS_ENR %>%
mutate(PS_ENR, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length PS1dE9 ENR")+scale_fill_jco()+
facet_wrap(~Age_group)
Latency Graphs
WT_STD %>%
mutate(WT_STD, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Latency in s",
title="Mean Latency in s WT STD")+scale_fill_jco()
dTg_STD %>%
mutate(dTg_STD, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Latency in s",
title="Mean Latency in s dTg STD")+scale_fill_jco()
APP_STD %>%
mutate(APP_STD, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Latency in s",
title="Mean Latency in s APPswe1 STD")+scale_fill_jco()
PS_STD %>%
mutate(PS_STD, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Latency in s",
title="Mean Latency in s PS1dE9 STD")+scale_fill_jco()
WT_ENR %>%
mutate(WT_ENR, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Latency in s",
title="Mean Latency in s WT ENR")+scale_fill_jco()
dTg_ENR %>%
mutate(dTg_ENR, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Latency in s",
title="Mean Latency in s dTg ENR")+scale_fill_jco()
APP_ENR %>%
mutate(APP_ENR, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Latency in s",
title="Mean Latency in s APPswe1 ENR")+scale_fill_jco()
PS_ENR %>%
mutate(PS_ENR, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, fill=Age_group))+geom_boxplot()+
labs(x="Day",
y="Average Latency in s",
title="Mean Latency in s PS1dE9 ENR")+scale_fill_jco()+
facet_wrap(~Age_group)
UPDATED Graphs
Heatmap_probe
par(mfrow = c(2, 2))
Rtrack::plot_density(wtp.metrics, title = "WT Probe Heatmap 3-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTgp.metrics, title = "dTg Probe Heatmap 3-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(APPp.metrics, title = "APPswe Probe Heatmap 3-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(PS1p.metrics, title = "PS1dE9 Probe Heatmap 3-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
par(mfrow = c(2, 4))
Rtrack::plot_density(wtpstd.metrics, title = "WT Probe Heatmap STD 3-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTgpstd.metrics, title = "dTg Probe Heatmap STD 3-25mo", col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(APPpstd.metrics, title = "APPswe Probe Heatmap STD 3-25mo", col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(PS1pstd.metrics, title = "PS1dE9 Probe Heatmap STD 3-25mo", col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(wtpenr.metrics, title = "WT Probe Heatmap ENR 3-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTgpenr.metrics, title = "dTg Probe Heatmap ENR 3-25mo", col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(APPpenr.metrics, title = "APPswe Probe Heatmap ENR 3-25mo", col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(PS1penr.metrics, title = "PS1dE9 Probe Heatmap ENR 3-25mo", col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
WT -> dTg -> APPswe -> PS1dE9
par(mfrow = c(1, 3))
###########WT_Probe##########
Rtrack::plot_density(wtpstd3.metrics, title = "WT Probe Heatmap STD 3mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(wtpstd14.metrics, title = "WT Probe Heatmap STD 13-14mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(wtpstd25.metrics, title = "WT Probe Heatmap STD 17-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(wtpenr3.metrics, title = "WT Probe Heatmap ENR 3mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(wtpenr14.metrics, title = "WT Probe Heatmap ENR 13-14mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(wtpenr25.metrics, title = "WT Probe Heatmap ENR 17-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
###########dTg_Probe##########
Rtrack::plot_density(dTgpstd3.metrics, title = "dTg Probe Heatmap STD 3mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTgpstd14.metrics, title = "dTg Probe Heatmap STD 13-14mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTgpstd25.metrics, title = "dTg Probe Heatmap STD 17-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTgpenr3.metrics, title = "dTg Probe Heatmap ENR 3mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTgpenr14.metrics, title = "dTg Probe Heatmap ENR 13-14mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(dTgpenr25.metrics, title = "dTg Probe Heatmap ENR 17-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
###########APP_Probe##########
Rtrack::plot_density(APPpstd3.metrics, title = "APPswe Probe Heatmap STD 3mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(APPpstd25.metrics, title = "APPswe Probe Heatmap STD 17-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(APPpenr3.metrics, title = "APPswe Probe Heatmap ENR 3mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(APPpenr25.metrics, title = "APPswe Probe Heatmap ENR 17-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
###########PS1_Probe##########
Rtrack::plot_density(PS1pstd3.metrics, title = "PS1dE9 Probe Heatmap STD 3mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(PS1pstd25.metrics, title = "PS1dE9 Probe Heatmap STD 17-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(PS1penr3.metrics, title = "PS1dE9 Probe Heatmap ENR 3mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Rtrack::plot_density(PS1penr25.metrics, title = "PS1dE9 Probe Heatmap ENR 17-25mo",
col = colorRampPalette(c("#000C9E", "#00FEF6", "#FE009E"))(100))
Path Length Graphs
mo3=filter(Results, Age_group=='3')
mo14=filter(Results, Age_group=='13-14')
mo25=filter(Results, Age_group=='17-25')
mo3 %>%
mutate(mo3, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Condition))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length 3mo mice")+scale_fill_manual(values = c("dTg_ENR" = "#ad5fc9", "dTg_STD" = "#bc91cc","WT_ENR" = "#6eca64", "WT_STD" = "#98cc93","APPswe_ENR" = "#d6564b", "APPswe_STD" = "#db867f","PS1dE9_ENR" = "#918730", "PS1dE9_STD" = "#c5b740"))
mo14 %>%
mutate(mo14, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Condition))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length 13-14mo mice")+scale_fill_manual(values = c("dTg_ENR" = "#ad5fc9", "dTg_STD" = "#bc91cc","WT_ENR" = "#6eca64", "WT_STD" = "#98cc93","APPswe_ENR" = "#d6564b", "APPswe_STD" = "#db867f","PS1dE9_ENR" = "#918730", "PS1dE9_STD" = "#c5b740"))
mo25 %>%
mutate(mo25, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, fill=Condition))+geom_boxplot()+
labs(x="Day",
y="Average Path length",
title="Mean Path length 17-25mo mice")+scale_fill_manual(values = c("dTg_ENR" = "#6c7ed7", "dTg_STD" = "#909ef3","WT_ENR" = "#9f48a3", "WT_STD" = "#ce73cf","APPswe_ENR" = "#c85632", "APPswe_STD" = "#e9724b","PS1dE9_ENR" = "#9f9201", "PS1dE9_STD" = "#cab95b"))
Boxplot explanation:
Middle line in box -> Median
Box -> shows middle 50% of data(Distance between 1. and 3. Quartil)
Whisker(vertikal lines) -> show upper/lower 25% of data w/o outliers
Points -> outlier
Velocity (Mean) Graphs
mo3=filter(Results, Age_group=='3')
mo14=filter(Results, Age_group=='13-14')
mo25=filter(Results, Age_group=='17-25')
mo3 %>%
mutate(mo3, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=mean.velocity, fill=Condition))+geom_boxplot()+
labs(x="Day",
y="Average Velocity",
title="Mean Velocity 3mo mice")+scale_fill_manual(values = c("dTg_ENR" = "#ad5fc9", "dTg_STD" = "#bc91cc","WT_ENR" = "#6eca64", "WT_STD" = "#98cc93","APPswe_ENR" = "#d6564b", "APPswe_STD" = "#db867f","PS1dE9_ENR" = "#918730", "PS1dE9_STD" = "#c5b740"))
mo14 %>%
mutate(mo14, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=mean.velocity, fill=Condition))+geom_boxplot()+
labs(x="Day",
y="Average Velocity",
title="Mean Velocity 13-14mo mice")+scale_fill_manual(values = c("dTg_ENR" = "#ad5fc9", "dTg_STD" = "#bc91cc","WT_ENR" = "#6eca64", "WT_STD" = "#98cc93","APPswe_ENR" = "#d6564b", "APPswe_STD" = "#db867f","PS1dE9_ENR" = "#918730", "PS1dE9_STD" = "#c5b740"))
mo25 %>%
mutate(mo25, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=mean.velocity, fill=Condition))+geom_boxplot()+
labs(x="Day",
y="Average Velocity",
title="Mean Velocity 17-25mo mice")+scale_fill_manual(values = c("dTg_ENR" = "#6c7ed7", "dTg_STD" = "#909ef3","WT_ENR" = "#9f48a3", "WT_STD" = "#ce73cf","APPswe_ENR" = "#c85632", "APPswe_STD" = "#e9724b","PS1dE9_ENR" = "#9f9201", "PS1dE9_STD" = "#cab95b"))
Strategy (Thresholded) Graphs
par(mfrow = c(2, 2))
Rtrack::plot_strategies(Rtrack::threshold_strategies(strategies, 0.4), experiment = experiment,
factor = "All", exclude.probe = TRUE)
Probe Trial Graphs
Probe Trial Number of Goals Crossings
mo3.probe=filter(Results, Age_group=='3'&`_Day`=='7'&`_Trial`=='1')
mo14.probe=filter(Results, Age_group=='13-14'&`_Day`=='7'&`_Trial`=='1')
mo25.probe=filter(Results, Age_group=='17-25'&`_Day`=='7'&`_Trial`=='1')
mo3.probe %>%
ggplot(aes(x=`Strain`,y=goal.crossings, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Number of Goal Crossings",
title="Probe Trial Number of Goal Crossings 3mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
mo14.probe %>%
ggplot(aes(x=`Strain`,y=goal.crossings, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Number of Goal Crossings",
title="Probe Trial Number of Goal Crossings 13-14mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
mo25.probe %>%
ggplot(aes(x=`Strain`,y=goal.crossings, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Number of Goal Crossings",
title="Probe Trial Number of Goal Crossings 17-25mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
Probe Trial Number of former Goals Crossings
mo3.probe=filter(Results, Age_group=='3'&`_Day`=='7'&`_Trial`=='1')
mo14.probe=filter(Results, Age_group=='13-14'&`_Day`=='7'&`_Trial`=='1')
mo25.probe=filter(Results, Age_group=='17-25'&`_Day`=='7'&`_Trial`=='1')
mo3.probe %>%
ggplot(aes(x=`Strain`,y=old.goal.crossings, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Number of old Goal Crossings",
title="Probe Trial Number of former Goal Crossings 3mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
mo14.probe %>%
ggplot(aes(x=`Strain`,y=old.goal.crossings, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Number of old Goal Crossings",
title="Probe Trial Number of former Goal Crossings 13-14mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
mo25.probe %>%
ggplot(aes(x=`Strain`,y=old.goal.crossings, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Number of Old Goal Crossings",
title="Probe Trial Number of former Goal Crossings 17-25mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
Probe Trial Time in old goal zone
mo3.probe=filter(Results, Age_group=='3'&`_Day`=='7'&`_Trial`=='1')
mo14.probe=filter(Results, Age_group=='13-14'&`_Day`=='7'&`_Trial`=='1')
mo25.probe=filter(Results, Age_group=='17-25'&`_Day`=='7'&`_Trial`=='1')
mo3.probe %>%
ggplot(aes(x=`Strain`,y=time.in.zone.old.goal, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Time in s",
title="Probe Trial Time spent in old goal 3mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
mo14.probe %>%
ggplot(aes(x=`Strain`,y=time.in.zone.old.goal, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Time in s",
title="Probe Trial Time spent in old goal 13-14mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
mo25.probe %>%
ggplot(aes(x=`Strain`,y=time.in.zone.old.goal, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Time in s",
title="Probe Trial Time spent in old goal 17-25mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
Probe Trial Mean Initial heading error
mo3.probe=filter(Results, Age_group=='3'&`_Day`=='7'&`_Trial`=='1')
mo14.probe=filter(Results, Age_group=='13-14'&`_Day`=='7'&`_Trial`=='1')
mo25.probe=filter(Results, Age_group=='17-25'&`_Day`=='7'&`_Trial`=='1')
mo3.probe %>%
ggplot(aes(x=`Strain`,y=`mean.initial.heading.error`, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Initial heading error in %??",
title="Probe Trial Mean Initial heading error 3mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
mo14.probe %>%
ggplot(aes(x=`Strain`,y=`mean.initial.heading.error`, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Initial heading error in %??",
title="Probe Trial Mean Initial heading error 13-14mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
mo25.probe %>%
ggplot(aes(x=`Strain`,y=`mean.initial.heading.error`, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Initial heading error in ???",
title="Probe Trial Mean Initial heading error 17-25mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
Probe Trial Mean Distance old goal
3 Months
mo3.probe %>%
ggplot(aes(x=`Strain`,y=`mean.d.old.goal`, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Distance",
title="Probe Trial Mean Distance old goal 3mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
13-14 Months
mo14.probe %>%
ggplot(aes(x=`Strain`,y=`mean.d.old.goal`, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Distance",
title="Probe Trial Mean Distance old goal 13-14mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
17-25 Months
mo25.probe %>%
ggplot(aes(x=`Strain`,y=`mean.d.old.goal`, fill=Housing))+geom_boxplot()+
labs(x="Condition",
y="Distance",
title="Probe Trial Mean Distance old goal 17-25mo mice")+scale_fill_manual(values = c("ENR"="#b3669e","STD"="#98984d"))
Arena Quadrant Problem
knitr::include_graphics("Watermaze_Setup.png")
In Ethovision those Quadrants are marked (NE, SE, SW, NW).
In contrast to that, the quadrants that can be analyzed with RTrack are called as below:
“time.in.zone.n.quadrant”
”time.in.zone.e.quadrant”
“time.in.zone.s.quadrant”
”time.in.zone.w.quadrant”
knitr::include_graphics("Watermaze_Quadrant.png")
t-Tests
t-Tests (time in old goal zone of probe trials) between Age Groups
3 / 13-14
t.test(mo3.probe$time.in.zone.old.goal,mo14.probe$time.in.zone.old.goal)
Welch Two Sample t-test
data: mo3.probe$time.in.zone.old.goal and mo14.probe$time.in.zone.old.goal
t = 0.41802, df = 55.572, p-value = 0.6775
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.4742248 0.7242732
sample estimates:
mean of x mean of y
1.248872 1.123847
3 / 17-25
t.test(mo3.probe$time.in.zone.old.goal,mo25.probe$time.in.zone.old.goal)
Welch Two Sample t-test
data: mo3.probe$time.in.zone.old.goal and mo25.probe$time.in.zone.old.goal
t = -0.76178, df = 53.252, p-value = 0.4496
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.8365670 0.3759891
sample estimates:
mean of x mean of y
1.248872 1.479161
13-14 / 17-25
t.test(mo14.probe$time.in.zone.old.goal,mo25.probe$time.in.zone.old.goal)
Welch Two Sample t-test
data: mo14.probe$time.in.zone.old.goal and mo25.probe$time.in.zone.old.goal
t = -0.96822, df = 62.942, p-value = 0.3366
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-1.0886658 0.3780395
sample estimates:
mean of x mean of y
1.123847 1.479161
no significance between the overall groups
t-Tests (time in old goal zone of probe trials) between Strains & Housings of Age Group 17-25
17-25 WT STD/ENR
WTS.mo25.probe=filter(mo25.probe, Strain=='WT'&`Housing`=='STD')
WTE.mo25.probe=filter(mo25.probe, Strain=='WT'&`Housing`=='ENR')
t.test(WTS.mo25.probe$time.in.zone.old.goal,WTE.mo25.probe$time.in.zone.old.goal)
Welch Two Sample t-test
data: WTS.mo25.probe$time.in.zone.old.goal and WTE.mo25.probe$time.in.zone.old.goal
t = 1.2667, df = 15.225, p-value = 0.2243
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.5876549 2.3148994
sample estimates:
mean of x mean of y
2.196897 1.333275
13-14 WT STD/ENR
WTS.mo14.probe=filter(mo14.probe, Strain=='WT'&`Housing`=='STD')
WTE.mo14.probe=filter(mo14.probe, Strain=='WT'&`Housing`=='ENR')
t.test(WTS.mo14.probe$time.in.zone.old.goal,WTE.mo14.probe$time.in.zone.old.goal)
Welch Two Sample t-test
data: WTS.mo14.probe$time.in.zone.old.goal and WTE.mo14.probe$time.in.zone.old.goal
t = -0.4615, df = 11.792, p-value = 0.6528
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-2.172106 1.414007
sample estimates:
mean of x mean of y
1.278296 1.657345
3 WT STD/ENR
WTS.mo3.probe=filter(mo3.probe, Strain=='WT'&`Housing`=='STD')
WTE.mo3.probe=filter(mo3.probe, Strain=='WT'&`Housing`=='ENR')
t.test(WTS.mo3.probe$time.in.zone.old.goal,WTE.mo3.probe$time.in.zone.old.goal)
Welch Two Sample t-test
data: WTS.mo3.probe$time.in.zone.old.goal and WTE.mo3.probe$time.in.zone.old.goal
t = 0.86513, df = 16.892, p-value = 0.3991
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.8315724 1.9866145
sample estimates:
mean of x mean of y
1.724105 1.146584
no significance found
t-Tests (Path length of all trials) between Strains
17-25 WT/dTg
mo25.WT=filter(mo25, Strain=="WT")
mo25.dTg=filter(mo25, Strain=="dTg")
t.test(mo25.WT$path.length,mo25.dTg$path.length)
Welch Two Sample t-test
data: mo25.WT$path.length and mo25.dTg$path.length
t = -7.4557, df = 286.47, p-value = 1.067e-12
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-333.6846 -194.2992
sample estimates:
mean of x mean of y
667.5763 931.5682
17-25 WT/PS1dE9
mo25.WT=filter(mo25, Strain=="WT")
mo25.PS=filter(mo25, Strain=="PS1dE9")
t.test(mo25.WT$path.length,mo25.PS$path.length)
Welch Two Sample t-test
data: mo25.WT$path.length and mo25.PS$path.length
t = -2.4789, df = 228.85, p-value = 0.0139
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-183.21674 -20.94064
sample estimates:
mean of x mean of y
667.5763 769.6550
17-25 WT/APPswe
mo25.WT=filter(mo25, Strain=="WT")
mo25.AP=filter(mo25, Strain=="APPswe")
t.test(mo25.WT$path.length,mo25.AP$path.length)
Welch Two Sample t-test
data: mo25.WT$path.length and mo25.AP$path.length
t = -3.6486, df = 268.81, p-value = 0.0003167
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-217.38161 -65.00338
sample estimates:
mean of x mean of y
667.5763 808.7688
17-25 PS1dE9/APPswe
mo25.PS=filter(mo25, Strain=="PS1dE9")
mo25.AP=filter(mo25, Strain=="APPswe")
t.test(mo25.PS$path.length,mo25.AP$path.length)
Welch Two Sample t-test
data: mo25.PS$path.length and mo25.AP$path.length
t = -0.7493, df = 357.63, p-value = 0.4542
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-141.77175 63.54414
sample estimates:
mean of x mean of y
769.6550 808.7688
17-25 dTg/PS1dE9
mo25.dTg=filter(mo25, Strain=="dTg")
mo25.AP=filter(mo25, Strain=="PS1dE9")
t.test(mo25.dTg$path.length,mo25.PS$path.length)
Welch Two Sample t-test
data: mo25.dTg$path.length and mo25.PS$path.length
t = 3.2506, df = 343.79, p-value = 0.001266
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
63.94184 259.88464
sample estimates:
mean of x mean of y
931.5682 769.6550
17-25 dTg/APPswe
mo25.dTg=filter(mo25, Strain=="dTg")
mo25.AP=filter(mo25, Strain=="APPswe")
t.test(mo25.dTg$path.length,mo25.AP$path.length)
Welch Two Sample t-test
data: mo25.dTg$path.length and mo25.AP$path.length
t = 2.5701, df = 380.87, p-value = 0.01055
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
28.85462 216.74425
sample estimates:
mean of x mean of y
931.5682 808.7688
t-Tests (Latency to goal of all trials) between Strains
3 WT/dTg
mo3.WT=filter(mo3, Strain=="WT")
mo3.dTg=filter(mo3, Strain=="dTg")
t.test(mo3.WT$latency.to.goal,mo3.dTg$latency.to.goal)
Welch Two Sample t-test
data: mo3.WT$latency.to.goal and mo3.dTg$latency.to.goal
t = -4.2, df = 693.56, p-value = 3.017e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-6.188198 -2.245603
sample estimates:
mean of x mean of y
18.17189 22.38879
3 WT/PS1dE9
mo3.WT=filter(mo3, Strain=="WT")
mo3.PS=filter(mo3, Strain=="PS1dE9")
t.test(mo3.WT$latency.to.goal,mo3.PS$latency.to.goal)
Welch Two Sample t-test
data: mo3.WT$latency.to.goal and mo3.PS$latency.to.goal
t = -0.90349, df = 752.83, p-value = 0.3666
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-2.772454 1.024824
sample estimates:
mean of x mean of y
18.17189 19.04571
3 WT/APPswe
mo3.WT=filter(mo3, Strain=="WT")
mo3.AP=filter(mo3, Strain=="APPswe")
t.test(mo3.WT$latency.to.goal,mo3.AP$latency.to.goal)
Welch Two Sample t-test
data: mo3.WT$latency.to.goal and mo3.AP$latency.to.goal
t = -2.1842, df = 731.92, p-value = 0.02926
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-4.2466370 -0.2262895
sample estimates:
mean of x mean of y
18.17189 20.40835
3 PS1dE9/APPswe
mo3.PS=filter(mo3, Strain=="PS1dE9")
mo3.AP=filter(mo3, Strain=="APPswe")
t.test(mo3.PS$latency.to.goal,mo3.AP$latency.to.goal)
Welch Two Sample t-test
data: mo3.PS$latency.to.goal and mo3.AP$latency.to.goal
t = -1.3659, df = 783.68, p-value = 0.1724
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-3.3209834 0.5956863
sample estimates:
mean of x mean of y
19.04571 20.40835
3 dTg/PS1dE9
mo3.dTg=filter(mo3, Strain=="dTg")
mo3.AP=filter(mo3, Strain=="PS1dE9")
t.test(mo3.dTg$latency.to.goal,mo3.PS$latency.to.goal)
Welch Two Sample t-test
data: mo3.dTg$latency.to.goal and mo3.PS$latency.to.goal
t = 3.4211, df = 742.93, p-value = 0.0006578
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
1.424692 5.261480
sample estimates:
mean of x mean of y
22.38879 19.04571
3 dTg/APPswe
mo3.dTg=filter(mo3, Strain=="dTg")
mo3.AP=filter(mo3, Strain=="APPswe")
t.test(mo3.dTg$latency.to.goal,mo3.AP$latency.to.goal)
Welch Two Sample t-test
data: mo3.dTg$latency.to.goal and mo3.AP$latency.to.goal
t = 1.9164, df = 727.85, p-value = 0.0557
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.04838746 4.00926190
sample estimates:
mean of x mean of y
22.38879 20.40835
Logistic regression
Results table can be seen here
Strategy Legend
- 1 - thigmotaxis
- 2 - circling
- 3 - random path
- 4 - scanning
- 5 - chaining
- 6 - directed search
- 7 - corrected search
- 8 - direct path
- 9 - perseverance
Strategies 1-5 are less hippocampus-dependent, ‘unspatial’ and therefore get strategy.class = 0. In contrast to that, strategies 6-9 are more hippocampus-dependent, ‘spatial’ and get strategy.class = 1 assigned.
All probabilities in the following codes relate to choosing strategy.class = 1.
setwd("C:/Google/Uni/Bachelorarbeit/R/Analysis")
logistic.data=read_excel("logistic.reg.xlsx")
Age group 17-25 Housing
logistic.data.1725=filter(logistic.data, Age_group1725=='1')
fitting different logistic regression models with increasing complexity
simple model including housing only
logreg.1725.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = logistic.data.1725)
simple model including Strain only
logreg.1725.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = logistic.data.1725)
additive model including all factors
logreg.1725.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = logistic.data.1725)
interaction model including all factors
logreg.1725.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.1725)
Model comparisons using the anova function
anova(logreg.1725.add.1b, logreg.1725.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1308 1775.6
2 1310 1811.7 -2 -36.096 1.452e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model including Strain better than model including housing
anova(logreg.1725.add.2, logreg.1725.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1307 1774.6
2 1308 1775.6 -1 -1.0162 0.3134
adding factor housing does not improve the model
anova(logreg.1725.int, logreg.1725.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1304 1771.3
2 1308 1775.6 -4 -4.3588 0.3596
interaction model not better than additive model simple model including Strain only is the minimal adequate model
summary of minimal adequate model
summary(logreg.1725.add.1b)
Call:
glm(formula = strategy.class ~ Strain, family = binomial, data = logistic.data.1725)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.325 -1.222 1.037 1.037 1.475
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.10318 0.14378 0.718 0.472979
StraindTg -0.78083 0.20945 -3.728 0.000193 ***
StrainPS1dE9 -0.03339 0.20966 -0.159 0.873472
StrainWT 0.23739 0.16168 1.468 0.142040
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1813.9 on 1311 degrees of freedom
Residual deviance: 1775.6 on 1308 degrees of freedom
AIC: 1783.6
Number of Fisher Scoring iterations: 4
exp(coef(logreg.1725.add.1b))
(Intercept) StraindTg StrainPS1dE9 StrainWT
1.1086957 0.4580270 0.9671628 1.2679321
impact of predictor “Strain”
pred.data <- data.frame(Strain=c("WT", "dTg", "PS1dE9", "APPswe"))
pred.data$prob <- predict(logreg.1725.add.1b, newdata = pred.data, type = "response")
pred.data
Strain prob
1 WT 0.5843293
2 dTg 0.3367876
3 PS1dE9 0.5174419
4 APPswe 0.5257732
impact of predictor “housing”
pred.data2 <- data.frame(Housing=c("STD","ENR"))
pred.data2$prob <- predict(logreg.1725.add.1a, newdata = pred.data2, type = "response")
pred.data2
Housing prob
1 STD 0.5504451
2 ENR 0.5094044
Age group 13-14 Strain x Housing effects
logistic.data.1314=filter(logistic.data, Age_group1314=='1')
fitting different logistic regression models with increasing complexity simple model including housing only
logreg.1314.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = logistic.data.1314)
simple model including Strain only
logreg.1314.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = logistic.data.1314)
additive model including all factors
logreg.1314.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = logistic.data.1314)
interaction model including all factors
logreg.1314.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.1314)
model comparisons using the anova function
anova(logreg.1314.add.1b, logreg.1314.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1306 1724.2
2 1306 1804.4 0 -80.16
no Df, same model fit?
anova(logreg.1314.add.2, logreg.1314.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1305 1718.1
2 1306 1724.2 -1 -6.1765 0.01295 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
additive model shows significantly better fit (Pr=0.01295)
anova(logreg.1314.int, logreg.1314.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1304 1712.2
2 1306 1724.2 -2 -11.999 0.00248 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction model better than simple Strain model (Pr=0.00248) interaction model including Strain*Housing is the best fitting model
summary of minimal adequate model
summary(logreg.1314.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = logistic.data.1314)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.4842 -0.9285 -0.9253 1.1143 1.4525
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.626772 0.118643 -5.283 1.27e-07 ***
HousingSTD 0.008426 0.167152 0.050 0.9598
StrainWT 1.324112 0.163290 8.109 5.11e-16 ***
HousingSTD:StrainWT -0.555484 0.230430 -2.411 0.0159 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1811.7 on 1307 degrees of freedom
Residual deviance: 1712.3 on 1304 degrees of freedom
AIC: 1720.3
Number of Fisher Scoring iterations: 4
exp(coef(logreg.1314.int))
(Intercept) HousingSTD StrainWT HousingSTD:StrainWT
0.5343137 1.0084617 3.7588467 0.5737945
impact of predictor “Strain*Housing”
pred.data1314 <- data.frame(Strain=c("WT", "WT","dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pred.data1314$prob <- predict(logreg.1314.int, newdata = pred.data1314, type = "response")
pred.data1314
Strain Housing prob
1 WT STD 0.5375000
2 WT ENR 0.6675978
3 dTg STD 0.3501577
4 dTg ENR 0.3482428
Age group 3 Strain x Housing
logistic.data.3=filter(logistic.data, Age_group3=='1')
fitting different logistic regression models with increasing complexity simple model including housing only
logreg.3.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = logistic.data.3)
simple model including Strain only
logreg.3.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = logistic.data.3)
additive model including all factors
logreg.3.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = logistic.data.3)
interaction model including all factors
logreg.3.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.3)
comparisons between model using the anova function
anova(logreg.3.add.1b, logreg.3.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 3336 4458.5
2 3338 4516.0 -2 -57.513 3.245e-13 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model with Strain only is really good (Pr=3.245e-13)
anova(logreg.3.add.2, logreg.3.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 3335 4440.3
2 3336 4458.5 -1 -18.243 1.945e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
adding factor housing also has good fit (Pr=1.945e-5)
anova(logreg.3.int, logreg.3.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 3332 4428.8
2 3336 4458.5 -4 -29.694 5.648e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction model better than additive model (Pr=5.648e-6) interaction model is the best
summary of Strain only model
summary(logreg.3.add.1b)
Call:
glm(formula = strategy.class ~ Strain, family = binomial, data = logistic.data.3)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.4508 -1.3122 0.9267 1.0483 1.2183
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.31144 0.06899 4.514 6.35e-06 ***
StraindTg -0.40719 0.09715 -4.192 2.77e-05 ***
StrainPS1dE9 0.31166 0.09914 3.143 0.00167 **
StrainWT 0.30702 0.10290 2.984 0.00285 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 4529.0 on 3339 degrees of freedom
Residual deviance: 4458.5 on 3336 degrees of freedom
AIC: 4466.5
Number of Fisher Scoring iterations: 4
exp(coef(logreg.3.add.1b))
(Intercept) StraindTg StrainPS1dE9 StrainWT
1.3653846 0.6655165 1.3656859 1.3593683
summary of interaction model
summary(logreg.3.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = logistic.data.3)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.5713 -1.2014 0.8293 1.0221 1.2715
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.571375 0.099833 5.723 1.04e-08 ***
HousingSTD -0.515022 0.139153 -3.701 0.000215 ***
StraindTg -0.567129 0.135864 -4.174 2.99e-05 ***
StrainPS1dE9 0.319191 0.145466 2.194 0.028217 *
StrainWT -0.008040 0.153664 -0.052 0.958274
HousingSTD:StraindTg 0.292295 0.195814 1.493 0.135512
HousingSTD:StrainPS1dE9 0.001266 0.200208 0.006 0.994953
HousingSTD:StrainWT 0.610701 0.207830 2.938 0.003298 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 4529.0 on 3339 degrees of freedom
Residual deviance: 4428.8 on 3332 degrees of freedom
AIC: 4444.8
Number of Fisher Scoring iterations: 4
exp(coef(logreg.3.int))
(Intercept) HousingSTD StraindTg
1.7707006 0.5974872 0.5671514
StrainPS1dE9 StrainWT HousingSTD:StraindTg
1.3760135 0.9919925 1.3394975
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
1.0012672 1.8417220
impact of predictor “Strain”
pred.data3 <- data.frame(Strain=c("WT", "dTg", "PS1dE9", "APPswe"))
pred.data3$prob <- predict(logreg.3.add.1b, newdata = pred.data3, type = "response")
pred.data3
Strain prob
1 WT 0.6498674
2 dTg 0.4760793
3 PS1dE9 0.6509217
4 APPswe 0.5772358
impact of predictors “Strain x Housing”
pred.data3x <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pred.data3x$prob <- predict(logreg.3.int, newdata = pred.data3x, type = "response")
pred.data3x
Strain Housing prob
1 WT STD 0.6590389
2 WT ENR 0.6372240
3 dTg STD 0.4455959
4 dTg ENR 0.5010616
5 PS1dE9 STD 0.5931034
6 PS1dE9 ENR 0.7090069
7 APPswe STD 0.5140845
8 APPswe ENR 0.6390805
The full overview of the logistic regression results table is here.
Age group 17-25 acquisition Strain
logistic.data.1725.acq=filter(logistic.data.1725, `_Day`=='1'|`_Day`=='2'|`_Day`=='3'|`_Day`=='4'|`_Day`=='5'|`_Day`=='6')
fitting different logistic regression models with increasing complexity
simple model including housing only
logreg.1725.acq.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = logistic.data.1725.acq)
simple model including Strain only
logreg.1725.acq.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = logistic.data.1725.acq)
additive model including all factors
logreg.1725.acq.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = logistic.data.1725.acq)
interaction model including all factors
logreg.1725.acq.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.1725.acq)
Model comparisons using the anova function
anova(logreg.1725.acq.add.1b, logreg.1725.acq.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 788 1067.9
2 790 1088.0 -2 -20.051 4.427e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model including Strain better than model including housing
anova(logreg.1725.acq.add.2, logreg.1725.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 787 1067.9
2 788 1067.9 -1 -0.016692 0.8972
adding factor housing does not improve the model
anova(logreg.1725.acq.int, logreg.1725.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 784 1063.0
2 788 1067.9 -4 -4.9469 0.2928
summary(logreg.1725.acq.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = logistic.data.1725.acq)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.1632 -1.1575 -0.8672 1.1974 1.8182
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.69315 0.30619 -2.264 0.0236 *
HousingSTD 0.63599 0.38851 1.637 0.1016
StraindTg -0.09097 0.40387 -0.225 0.8218
StrainPS1dE9 0.59471 0.39935 1.489 0.1364
StrainWT 0.64619 0.33547 1.926 0.0541 .
HousingSTD:StraindTg -1.29223 0.59810 -2.161 0.0307 *
HousingSTD:StrainPS1dE9 -0.70460 0.54826 -1.285 0.1987
HousingSTD:StrainWT -0.62265 0.43190 -1.442 0.1494
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1088.1 on 791 degrees of freedom
Residual deviance: 1063.0 on 784 degrees of freedom
AIC: 1079
Number of Fisher Scoring iterations: 4
exp(coef(logreg.1725.acq.int))
(Intercept) HousingSTD StraindTg
0.5000000 1.8888889 0.9130435
StrainPS1dE9 StrainWT HousingSTD:StraindTg
1.8125000 1.9082569 0.2746572
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
0.4943049 0.5365216
impact of predictor “Strain”
pred.data.17.acq <- data.frame(Strain=c("WT", "dTg", "PS1dE9", "APPswe"))
pred.data.17.acq$prob <- predict(logreg.1725.acq.add.1b, newdata = pred.data.17.acq, type = "response")
pred.data.17.acq
Strain prob
1 WT 0.4900222
2 dTg 0.2631579
3 PS1dE9 0.4678899
4 APPswe 0.4237288
impact of predictor “Housing”
pred.data.17.acq <- data.frame(Housing=c("STD","ENR"))
pred.data.17.acq$prob <- predict(logreg.1725.acq.add.1a, newdata = pred.data.17.acq, type = "response")
pred.data.17.acq
Housing prob
1 STD 0.4516129
2 ENR 0.4370180
Age group 17-25 reversal Strain
logistic.data.1725.rev=filter(logistic.data.1725, `_Day`=='7'|`_Day`=='8'|`_Day`=='9'|`_Day`=='10')
fitting different logistic regression models with increasing complexity
simple model including housing only
logreg.1725.rev.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = logistic.data.1725.rev)
simple model including Strain only
logreg.1725.rev.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = logistic.data.1725.rev)
additive model including all factors
logreg.1725.rev.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = logistic.data.1725.rev)
interaction model including all factors
logreg.1725.rev.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.1725.rev)
Model comparisons using the anova function
anova(logreg.1725.rev.add.1b, logreg.1725.rev.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 516 643.08
2 518 662.36 -2 -19.28 6.509e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model including Strain better than model including housing
anova(logreg.1725.rev.add.2, logreg.1725.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 515 641.11
2 516 643.08 -1 -1.9658 0.1609
adding factor housing does not improve the model
anova(logreg.1725.rev.int, logreg.1725.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 512 627.21
2 516 643.08 -4 -15.869 0.003201 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction model better than additive model
summary of minimal adequate model
summary(logreg.1725.rev.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = logistic.data.1725.rev)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.6567 -1.2049 0.7647 0.8340 1.6033
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.79851 0.40139 1.989 0.046660 *
HousingSTD -0.04082 0.50895 -0.080 0.936071
StraindTg -1.75992 0.51715 -3.403 0.000666 ***
StrainPS1dE9 -0.73397 0.53877 -1.362 0.173105
StrainWT 0.28141 0.44533 0.632 0.527444
HousingSTD:StraindTg 1.79069 0.71471 2.505 0.012229 *
HousingSTD:StrainPS1dE9 0.76474 0.73051 1.047 0.295166
HousingSTD:StrainWT -0.16186 0.57128 -0.283 0.776929
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 665.61 on 519 degrees of freedom
Residual deviance: 627.21 on 512 degrees of freedom
AIC: 643.21
Number of Fisher Scoring iterations: 4
exp(coef(logreg.1725.rev.int))
(Intercept) HousingSTD StraindTg
2.2222222 0.9600000 0.1720588
StrainPS1dE9 StrainWT HousingSTD:StraindTg
0.4800000 1.3250000 5.9935897
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
2.1484375 0.8505620
impact of predictor “Strain”
pred.data.17.revs <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pred.data.17.revs$prob <- predict(logreg.1725.rev.int, newdata = pred.data.17.revs, type = "response")
pred.data.17.revs
Strain Housing prob
1 WT STD 0.7062500
2 WT ENR 0.7464789
3 dTg STD 0.6875000
4 dTg ENR 0.2765957
5 PS1dE9 STD 0.6875000
6 PS1dE9 ENR 0.5161290
7 APPswe STD 0.6808511
8 APPswe ENR 0.6896552
Age group 13-14 acquisition Strain x Housing
logistic.data.acq.1314=filter(logistic.data.1314, `_Day`=='1'|`_Day`=='2'|`_Day`=='3'|`_Day`=='4'|`_Day`=='5'|`_Day`=='6')
fitting different logistic regression models with increasing complexity simple model including housing only
logreg.1314.acq.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = logistic.data.acq.1314)
simple model including Strain only
logreg.1314.acq.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = logistic.data.acq.1314)
additive model including all factors
logreg.1314.acq.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = logistic.data.acq.1314)
interaction model including all factors
logreg.1314.acq.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.acq.1314)
comparisons between model using the anova function
anova(logreg.1314.acq.add.1b, logreg.1314.acq.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 779 1014.5
2 779 1049.4 0 -34.833
model with Strain only is good
anova(logreg.1314.acq.add.2, logreg.1314.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 778 1009.0
2 779 1014.5 -1 -5.5851 0.01811 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
adding factor housing also has good fit
anova(logreg.1314.acq.int, logreg.1314.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 777 1008.2
2 779 1014.5 -2 -6.3566 0.04166 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
additive model better than interaction model additive model is the best
summary of interactive model
summary(logreg.1314.acq.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = logistic.data.acq.1314)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.2994 -1.0987 -0.7931 1.2582 1.6186
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.7916 0.1583 -5.001 5.70e-07 ***
HousingSTD -0.2038 0.2278 -0.895 0.371
StrainWT 1.0738 0.2100 5.112 3.18e-07 ***
HousingSTD:StrainWT -0.2664 0.3033 -0.878 0.380
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1055.6 on 780 degrees of freedom
Residual deviance: 1008.2 on 777 degrees of freedom
AIC: 1016.2
Number of Fisher Scoring iterations: 4
exp(coef(logreg.1314.acq.int))
(Intercept) HousingSTD StrainWT HousingSTD:StrainWT
0.4531250 0.8155922 2.9265367 0.7660990
impact of predictors “Strain x Housing”
pred.data1314.acq <- data.frame(Strain=c("WT","WT", "dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pred.data1314.acq$prob <- predict(logreg.1314.acq.add.2, newdata = pred.data1314.acq, type = "response")
pred.data1314.acq
Strain Housing prob
1 WT STD 0.4682013
2 WT ENR 0.5565671
3 dTg STD 0.2545257
4 dTg ENR 0.3273906
Age group 13-14 reversal Strain x Housing
logistic.data.rev.1314=filter(logistic.data.1314, `_Day`=='7'|`_Day`=='8'|`_Day`=='9'|`_Day`=='10')
fitting different logistic regression models with increasing complexity simple model including housing only
logreg.1314.rev.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = logistic.data.rev.1314)
simple model including Strain only
logreg.1314.rev.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = logistic.data.rev.1314)
additive model including all factors
logreg.1314.rev.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = logistic.data.rev.1314)
interaction model including all factors
logreg.1314.rev.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.rev.1314)
comparisons between model using the anova function
anova(logreg.1314.rev.add.1b, logreg.1314.rev.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 525 659.45
2 525 710.30 0 -50.855
anova(logreg.1314.rev.add.2, logreg.1314.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 524 658.28
2 525 659.45 -1 -1.1655 0.2803
adding factor does not improve model
anova(logreg.1314.rev.int, logreg.1314.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 523 650.44
2 525 659.45 -2 -9.01 0.01105 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction model better than additive model interaction model is the best
summary of interaction model
summary(logreg.1314.rev.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = logistic.data.rev.1314)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.8297 -1.1247 0.6444 0.9049 1.3508
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.3989 0.1810 -2.204 0.02754 *
HousingSTD 0.2737 0.2533 1.081 0.27974
StrainWT 1.8652 0.2799 6.664 2.67e-11 ***
HousingSTD:StrainWT -1.0586 0.3805 -2.783 0.00539 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 711.87 on 526 degrees of freedom
Residual deviance: 650.44 on 523 degrees of freedom
AIC: 658.44
Number of Fisher Scoring iterations: 4
exp(coef(logreg.1314.rev.int))
(Intercept) HousingSTD StrainWT HousingSTD:StrainWT
0.6710526 1.3148789 6.4575163 0.3469306
impact of predictors “Strain x Housing”
pred.data1314.rev <- data.frame(Strain=c("WT","WT", "dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pred.data1314.rev$prob <- predict(logreg.1314.rev.int, newdata = pred.data1314.rev, type = "response")
pred.data1314.rev
Strain Housing prob
1 WT STD 0.6640625
2 WT ENR 0.8125000
3 dTg STD 0.4687500
4 dTg ENR 0.4015748
Age group 3 acquisition Strain x Housing
logistic.data.acq.3=filter(logistic.data.3, `_Day`=='1'|`_Day`=='2'|`_Day`=='3'|`_Day`=='4'|`_Day`=='5'|`_Day`=='6')
fitting different logistic regression models with increasing complexity simple model including housing only
logreg.3.acq.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = logistic.data.acq.3)
simple model including Strain only
logreg.3.acq.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = logistic.data.acq.3)
additive model including all factors
logreg.3.acq.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = logistic.data.acq.3)
interaction model including all factors
logreg.3.acq.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.acq.3)
comparisons between model using the anova function
anova(logreg.3.acq.add.1b, logreg.3.acq.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1989 2683.6
2 1991 2753.3 -2 -69.785 7.021e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model with Strain only is really good
anova(logreg.3.acq.add.2, logreg.3.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1988 2668.9
2 1989 2683.6 -1 -14.652 0.0001293 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
adding factor housing also has good fit
anova(logreg.3.acq.int, logreg.3.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1985 2653.5
2 1989 2683.6 -4 -30.063 4.752e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction model better than additive model interaction model is the best
summary of interaction model
summary(logreg.3.acq.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = logistic.data.acq.3)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.412 -1.234 0.960 1.089 1.624
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.30111 0.12520 2.405 0.016175 *
HousingSTD -0.59571 0.17841 -3.339 0.000841 ***
StraindTg -0.66816 0.17434 -3.832 0.000127 ***
StrainPS1dE9 0.23441 0.17942 1.307 0.191370
StrainWT -0.08980 0.19226 -0.467 0.640462
HousingSTD:StraindTg -0.04436 0.26255 -0.169 0.865840
HousingSTD:StrainPS1dE9 0.19165 0.25270 0.758 0.448197
HousingSTD:StrainWT 0.89318 0.26355 3.389 0.000701 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 2762.8 on 1992 degrees of freedom
Residual deviance: 2653.5 on 1985 degrees of freedom
AIC: 2669.5
Number of Fisher Scoring iterations: 4
exp(coef(logreg.3.acq.int))
(Intercept) HousingSTD StraindTg
1.3513514 0.5511724 0.5126506
StrainPS1dE9 StrainWT HousingSTD:StraindTg
1.2641667 0.9141176 0.9566127
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
1.2112495 2.4428887
impact of predictors “Strain x Housing”
pred.data3.acq <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pred.data3.acq$prob <- predict(logreg.3.acq.int, newdata = pred.data3.acq, type = "response")
pred.data3.acq
Strain Housing prob
1 WT STD 0.6245211
2 WT ENR 0.5526316
3 dTg STD 0.2675439
4 dTg ENR 0.4092527
5 PS1dE9 STD 0.5328185
6 PS1dE9 ENR 0.6307692
7 APPswe STD 0.4268775
8 APPswe ENR 0.5747126
Age group 3 reversal Strain x Housing
logistic.data.rev.3=filter(logistic.data.3, `_Day`=='7'|`_Day`=='8'|`_Day`=='9'|`_Day`=='10')
fitting different logistic regression models with increasing complexity simple model including housing only
logreg.3.rev.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = logistic.data.rev.3)
simple model including Strain only
logreg.3.rev.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = logistic.data.rev.3)
additive model including all factors
logreg.3.rev.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = logistic.data.rev.3)
interaction model including all factors
logreg.3.rev.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.rev.3)
comparisons between model using the anova function
anova(logreg.3.rev.add.1b, logreg.3.rev.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1343 1614.9
2 1345 1618.3 -2 -3.3859 0.184
model with Strain only is really good (Pr=3.245e-13)
anova(logreg.3.rev.add.2, logreg.3.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1342 1609.6
2 1343 1614.9 -1 -5.326 0.02101 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
adding factor housing also has good fit (Pr=1.945e-5)
anova(logreg.3.rev.int, logreg.3.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1339 1598.6
2 1343 1614.9 -4 -16.331 0.002606 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction model better than additive model (Pr=5.648e-6) interaction model is the best
summary of interaction model
summary(logreg.3.rev.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = logistic.data.rev.3)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.8720 -1.4233 0.7836 0.8752 0.9500
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.0234 0.1719 5.953 2.63e-09 ***
HousingSTD -0.4410 0.2339 -1.886 0.0593 .
StraindTg -0.4617 0.2287 -2.019 0.0435 *
StrainPS1dE9 0.5383 0.2643 2.036 0.0417 *
StrainWT 0.1501 0.2705 0.555 0.5790
HousingSTD:StraindTg 0.7387 0.3282 2.251 0.0244 *
HousingSTD:StrainPS1dE9 -0.3585 0.3481 -1.030 0.3031
HousingSTD:StrainWT 0.1640 0.3549 0.462 0.6441
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1622.9 on 1346 degrees of freedom
Residual deviance: 1598.6 on 1339 degrees of freedom
AIC: 1614.6
Number of Fisher Scoring iterations: 4
exp(coef(logreg.3.rev.int))
(Intercept) HousingSTD StraindTg
2.7826087 0.6433972 0.6302083
StrainPS1dE9 StrainWT HousingSTD:StraindTg
1.7130208 1.1619792 2.0931950
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
0.6987137 1.1781761
impact of predictors “Strain x Housing”
pred.data3.rev <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pred.data3.rev$prob <- predict(logreg.3.rev.int, newdata = pred.data3.rev, type = "response")
pred.data3.rev
Strain Housing prob
1 WT STD 0.7102273
2 WT ENR 0.7637795
3 dTg STD 0.7025316
4 dTg ENR 0.6368421
5 PS1dE9 STD 0.6818182
6 PS1dE9 ENR 0.8265896
7 APPswe STD 0.6416185
8 APPswe ENR 0.7356322
Results
Results table can be seen here
Strategy Overview plot
knitr::include_graphics("strategy.png")
Visualization results log. reg
2D - Age group 3
setwd("C:/Google/Uni/Bachelorarbeit/R/Analysis")
probs=read_excel("results_logistic_new.xlsx")
myColors = brewer.pal(4,"Set1")
names(myColors)=levels(probs$Housing)
colScale=scale_colour_manual(name="Housing",values=myColors)
probs$`Experiment_Phase`=as.factor(probs$`Experiment_Phase`)
probs3=filter(probs, Age_group=='3' & Model=='STRAIN*HOUSING')
gg = ggplot(probs3, mapping=aes(x=Strain, y=Probability, color=Housing)) + geom_jitter() + facet_grid(~Experiment_Phase) + labs(x="Strain", y="P(strategy.class 1)", title="Probability of 3 months old mice using Strategy class 1")
gg=gg+colScale
ggplotly(p=gg, height=400, width=800)
Strain*Housing interaction model used for predictions.
2D - Age group 13-14
probs13=filter(probs, Age_group=='13-14')
gg = ggplot(probs13, mapping=aes(x=Strain, y=Probability, color=Housing)) + geom_jitter() + facet_grid(~Experiment_Phase) + labs(x="Strain", y="P(strategy.class 1)", title="Probability of 13-14 months old mice using Strategy class 1")
gg=gg+colScale
ggplotly(gg, height=400, width=800)
Strain*Housing interaction model used for predictions of REV and BOTH phases. In the ACQ experiment phase, the additive model (Strain+Housing) shows the best fit. Take a look here
2D - Age group 17-25
probs17=filter(probs, Age_group=='17-25')
gg = ggplot(probs17, mapping=aes(x=Strain, y=Probability, color=Housing)) + geom_jitter() + facet_grid(~Experiment_Phase) + labs(x="Strain", y="P(strategy.class 1)", title="Probability of 17-25 months old mice using Strategy class 1", caption="test")
gg=gg+colScale
ggplotly(gg, height=400, width=800)
Strategy.class ~ Strain and Strategy.class ~ Housing models were used separately for ACQ and Both experiment phases. REV phase has best model fit with the Strategy.class ~ Strain*Housing interaction model.
3D Surface Plot
x=c("WT","dTg","PS1dE9","APPswe")
y=c("STD","ENR","ACQ STD","ACQ ENR", "REV STD", "REV ENR")
z=rbind(
c(0.1590389,-0.0544041,0.0931034,0.0140845),
c(0.137224,0.0010616,0.2090069,0.1390805),
c(0.1245211,-0.2324561,0.0328185,-0.0731225),
c(0.0526316,-0.0907473,0.1307692,0.0747126),
c(0.2102273,0.2025316,0.1818182,0.1416185),
c(0.2637795,0.1368421,0.3265896,0.2356322)
)
z2=rbind(
c(0,0,0,0),c(0,0,0,0),c(0,0,0,0),c(0,0,0,0),c(0,0,0,0),c(0,0,0,0))
ebene= plot_ly(type="surface", x=~x, y=~y, z=~z)
ebene= ebene %>% add_surface(z=~z2)
ebene= ebene %>% layout( title='Probability of Strategy class 1 in 3 months old mice compared to p=0.5')
ebene
Interactive plot created with plotly
(Sievert et al., 2021) library.
testing citations(Garthe et al., 2016)
RTrack package used(Overall, 2020)
Thresholded Logistic regression
Strategy Legend
- 1 - thigmotaxis
- 2 - circling
- 3 - random path
- 4 - scanning
- 5 - chaining
- 6 - directed search
- 7 - corrected search
- 8 - direct path
- 9 - perseverance
Strategies 1-5 are less hippocampus-dependent, ‘unspatial’ and therefore get strategy.class = 0. In contrast to that, strategies 6-9 are more hippocampus-dependent, ‘spatial’ and get strategy.class = 1 assigned.
All probabilities in the following codes relate to choosing strategy.class = 1.
setwd("C:/Google/Uni/Bachelorarbeit/R/Analysis")
ogistic.data=read_excel("logistic_reg_thresh.xlsx")
Age group 17-25 Housing
ogistic.data.1725=filter(ogistic.data, Age_group1725=='1')
fitting different logistic regression models with increasing complexity
simple model including housing only
ogreg.1725.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = ogistic.data.1725)
simple model including Strain only
ogreg.1725.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = ogistic.data.1725)
additive model including all factors
ogreg.1725.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = ogistic.data.1725)
interaction model including all factors
ogreg.1725.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = ogistic.data.1725)
Model comparisons using the anova function
anova(ogreg.1725.add.1b, ogreg.1725.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 932 1124.8
2 934 1168.0 -2 -43.211 4.139e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model including Strain better than model including housing
anova(ogreg.1725.add.2, ogreg.1725.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 931 1123.7
2 932 1124.8 -1 -1.068 0.3014
adding factor housing does not improve the model
anova(ogreg.1725.int, ogreg.1725.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 928 1118.0
2 932 1124.8 -4 -6.7896 0.1474
interaction model not better than additive model simple model including Strain only is the minimal adequate model
summary of minimal adequate model
summary(ogreg.1725.add.1b)
Call:
glm(formula = strategy.class ~ Strain, family = binomial, data = ogistic.data.1725)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.6554 -1.0524 0.7657 0.7657 1.3078
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.69315 0.18058 3.838 0.000124 ***
StraindTg -0.99462 0.25461 -3.906 9.37e-05 ***
StrainPS1dE9 0.03774 0.26570 0.142 0.887047
StrainWT 0.38380 0.20539 1.869 0.061669 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1171.2 on 935 degrees of freedom
Residual deviance: 1124.8 on 932 degrees of freedom
AIC: 1132.8
Number of Fisher Scoring iterations: 4
exp(coef(ogreg.1725.add.1b))
(Intercept) StraindTg StrainPS1dE9 StrainWT
2.000000 0.369863 1.038462 1.467857
impact of predictor “Strain”
pre.data <- data.frame(Strain=c("WT", "dTg", "PS1dE9", "APPswe"))
pre.data$prob <- predict(ogreg.1725.add.1b, newdata = pre.data, type = "response")
pre.data
Strain prob
1 WT 0.7459165
2 dTg 0.4251969
3 PS1dE9 0.6750000
4 APPswe 0.6666667
impact of predictor “housing”
pre.data2 <- data.frame(Housing=c("STD","ENR"))
pre.data2$prob <- predict(ogreg.1725.add.1a, newdata = pre.data2, type = "response")
pre.data2
Housing prob
1 STD 0.7075665
2 ENR 0.6532438
Age group 13-14 Strain x Housing effects
ogistic.data.1314=filter(ogistic.data, Age_group1314=='1')
fitting different logistic regression models with increasing complexity simple model including housing only
ogreg.1314.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = ogistic.data.1314)
simple model including Strain only
ogreg.1314.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = ogistic.data.1314)
additive model including all factors
ogreg.1314.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = ogistic.data.1314)
interaction model including all factors
ogreg.1314.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = ogistic.data.1314)
model comparisons using the anova function
anova(ogreg.1314.add.1b, ogreg.1314.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 868 1024.4
2 868 1117.1 0 -92.65
no Df, same model fit?
anova(ogreg.1314.add.2, ogreg.1314.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 867 1023.8
2 868 1024.4 -1 -0.58952 0.4426
additive model shows significantly better fit (Pr=0.01295)
anova(ogreg.1314.int, ogreg.1314.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 866 1015.5
2 868 1024.4 -2 -8.9111 0.01161 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction model better than simple Strain model (Pr=0.00248) interaction model including Strain*Housing is the best fitting model
summary of minimal adequate model
summary(ogreg.1314.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = ogistic.data.1314)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.9169 -1.0996 0.5890 0.7732 1.2573
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.1859 0.1403 -1.325 0.18514
HousingSTD 0.2720 0.2030 1.339 0.18041
StrainWT 1.8496 0.2176 8.501 < 2e-16 ***
HousingSTD:StrainWT -0.8813 0.3064 -2.877 0.00402 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1118.3 on 869 degrees of freedom
Residual deviance: 1015.5 on 866 degrees of freedom
AIC: 1023.5
Number of Fisher Scoring iterations: 4
exp(coef(ogreg.1314.int))
(Intercept) HousingSTD StrainWT HousingSTD:StrainWT
0.8303571 1.3125529 6.3575894 0.4142512
impact of predictor “Strain*Housing”
pre.data1314 <- data.frame(Strain=c("WT", "WT","dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pre.data1314$prob <- predict(ogreg.1314.int, newdata = pre.data1314, type = "response")
pre.data1314
Strain Housing prob
1 WT STD 0.7416268
2 WT ENR 0.8407407
3 dTg STD 0.5215054
4 dTg ENR 0.4536585
Age group 3 Strain x Housing
ogistic.data.3=filter(ogistic.data, Age_group3=='1')
fitting different logistic regression models with increasing complexity simple model including housing only
ogreg.3.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = ogistic.data.3)
simple model including Strain only
ogreg.3.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = ogistic.data.3)
additive model including all factors
ogreg.3.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = ogistic.data.3)
interaction model including all factors
ogreg.3.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = ogistic.data.3)
comparisons between model using the anova function
anova(ogreg.3.add.1b, ogreg.3.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 2393 2730.5
2 2395 2803.6 -2 -73.096 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model with Strain only is really good (Pr=3.245e-13)
anova(ogreg.3.add.2, ogreg.3.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 2392 2726.2
2 2393 2730.5 -1 -4.2311 0.03969 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
adding factor housing also has good fit (Pr=1.945e-5)
anova(ogreg.3.int, ogreg.3.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 2389 2724.1
2 2393 2730.5 -4 -6.3947 0.1715
additive model better than interaction model (Pr=5.648e-6) additive model is the best
summary of Strain only model
summary(ogreg.3.add.1b)
Call:
glm(formula = strategy.class ~ Strain, family = binomial, data = ogistic.data.3)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.8414 -1.3582 0.7065 0.8176 1.0068
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.92408 0.08834 10.461 < 2e-16 ***
StraindTg -0.50857 0.12243 -4.154 3.27e-05 ***
StrainPS1dE9 0.33659 0.12929 2.603 0.00923 **
StrainWT 0.56859 0.14248 3.991 6.59e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 2805.7 on 2396 degrees of freedom
Residual deviance: 2730.5 on 2393 degrees of freedom
AIC: 2738.5
Number of Fisher Scoring iterations: 4
exp(coef(ogreg.3.add.1b))
(Intercept) StraindTg StrainPS1dE9 StrainWT
2.5195531 0.6013573 1.4001601 1.7657813
summary of additive model model
summary(ogreg.3.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = ogistic.data.3)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.8573 -1.2841 0.6659 0.7928 1.0743
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.9963 0.1194 8.343 < 2e-16 ***
HousingSTD -0.1629 0.1776 -0.917 0.35906
StraindTg -0.4404 0.1665 -2.645 0.00816 **
StrainPS1dE9 0.3971 0.1791 2.216 0.02666 *
StrainWT 0.4506 0.2058 2.190 0.02854 *
HousingSTD:StraindTg -0.1456 0.2462 -0.592 0.55417
HousingSTD:StrainPS1dE9 -0.1140 0.2595 -0.440 0.66027
HousingSTD:StrainWT 0.2445 0.2866 0.853 0.39374
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 2805.7 on 2396 degrees of freedom
Residual deviance: 2724.1 on 2389 degrees of freedom
AIC: 2740.1
Number of Fisher Scoring iterations: 4
exp(coef(ogreg.3.int))
(Intercept) HousingSTD StraindTg
2.7083333 0.8496756 0.6437870
StrainPS1dE9 StrainWT HousingSTD:StraindTg
1.4874725 1.5692308 0.8644712
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
0.8922211 1.2769194
impact of predictor “Strain”
pre.data3 <- data.frame(Strain=c("WT", "dTg", "PS1dE9", "APPswe"))
pre.data3$prob <- predict(ogreg.3.add.1b, newdata = pre.data3, type = "response")
pre.data3
Strain prob
1 WT 0.8164794
2 dTg 0.6024096
3 PS1dE9 0.7791411
4 APPswe 0.7158730
impact of predictors “Strain + Housing”
pre.data3x <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data3x$prob <- predict(ogreg.3.add.2, newdata = pre.data3x, type = "response")
pre.data3x
Strain Housing prob
1 WT STD 0.8040861
2 WT ENR 0.8327355
3 dTg STD 0.5768254
4 dTg ENR 0.6231321
5 PS1dE9 STD 0.7611506
6 PS1dE9 ENR 0.7944739
7 APPswe STD 0.6935843
8 APPswe ENR 0.7330278
The full overview of the logistic regression results table is here.
Age group 17-25 acquisition Strain
ogistic.data.1725.acq=filter(ogistic.data.1725, `_Day`=='1'|`_Day`=='2'|`_Day`=='3'|`_Day`=='4'|`_Day`=='5'|`_Day`=='6')
fitting different logistic regression models with increasing complexity
simple model including housing only
ogreg.1725.acq.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = ogistic.data.1725.acq)
simple model including Strain only
ogreg.1725.acq.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = ogistic.data.1725.acq)
additive model including all factors
ogreg.1725.acq.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = ogistic.data.1725.acq)
interaction model including all factors
ogreg.1725.acq.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = ogistic.data.1725.acq)
Model comparisons using the anova function
anova(ogreg.1725.acq.add.1b, ogreg.1725.acq.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 552 733.82
2 554 752.57 -2 -18.747 8.493e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model including Strain better than model including housing
anova(ogreg.1725.acq.add.2, ogreg.1725.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 551 733.82
2 552 733.82 -1 -0.0068548 0.934
adding factor housing does not improve the model
anova(ogreg.1725.acq.int, ogreg.1725.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 548 730.06
2 552 733.82 -4 -3.7677 0.4384
summary(ogreg.1725.acq.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = ogistic.data.1725.acq)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.4516 -1.3893 0.9260 0.9612 1.6394
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.1719 0.3393 -0.506 0.6125
HousingSTD 0.6419 0.4431 1.448 0.1475
StraindTg -0.1959 0.4573 -0.428 0.6684
StrainPS1dE9 0.6574 0.4649 1.414 0.1573
StrainWT 0.7967 0.3796 2.099 0.0358 *
HousingSTD:StraindTg -1.3156 0.7183 -1.832 0.0670 .
HousingSTD:StrainPS1dE9 -0.6013 0.6479 -0.928 0.3534
HousingSTD:StrainWT -0.7342 0.5001 -1.468 0.1421
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 752.70 on 555 degrees of freedom
Residual deviance: 730.06 on 548 degrees of freedom
AIC: 746.06
Number of Fisher Scoring iterations: 4
exp(coef(ogreg.1725.acq.int))
(Intercept) HousingSTD StraindTg
0.8421053 1.9000000 0.8221154
StrainPS1dE9 StrainWT HousingSTD:StraindTg
1.9296875 2.2181604 0.2683179
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
0.5481159 0.4798810
impact of predictor “Strain”
pre.data.17.acq <- data.frame(Strain=c("WT", "dTg", "PS1dE9", "APPswe"))
pre.data.17.acq$prob <- predict(ogreg.1725.acq.add.1b, newdata = pre.data.17.acq, type = "response")
pre.data.17.acq
Strain prob
1 WT 0.6400000
2 dTg 0.3582090
3 PS1dE9 0.6233766
4 APPswe 0.5517241
impact of predictor “Housing”
pre.data.17.acq <- data.frame(Housing=c("STD","ENR"))
pre.data.17.acq$prob <- predict(ogreg.1725.acq.add.1a, newdata = pre.data.17.acq, type = "response")
pre.data.17.acq
Housing prob
1 STD 0.5971731
2 ENR 0.5824176
Age group 17-25 reversal Strain
ogistic.data.1725.rev=filter(ogistic.data.1725, `_Day`=='7'|`_Day`=='8'|`_Day`=='9'|`_Day`=='10')
fitting different logistic regression models with increasing complexity
simple model including housing only
ogreg.1725.rev.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = ogistic.data.1725.rev)
simple model including Strain only
ogreg.1725.rev.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = ogistic.data.1725.rev)
additive model including all factors
ogreg.1725.rev.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = ogistic.data.1725.rev)
interaction model including all factors
ogreg.1725.rev.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = ogistic.data.1725.rev)
Model comparisons using the anova function
anova(ogreg.1725.rev.add.1b, ogreg.1725.rev.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 376 319.30
2 378 357.43 -2 -38.128 5.254e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model including Strain better than model including housing
anova(ogreg.1725.rev.add.2, ogreg.1725.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 375 316.76
2 376 319.30 -1 -2.5396 0.111
adding factor housing does not improve the model
anova(ogreg.1725.rev.int, ogreg.1725.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 372 290.8
2 376 319.3 -4 -28.505 9.852e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction model better than additive model
summary of minimal adequate model
summary(ogreg.1725.rev.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = ogistic.data.1725.rev)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.2035 0.4298 0.4895 0.4895 1.6176
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 17.57 989.05 0.018 0.986
HousingSTD -16.18 989.05 -0.016 0.987
StraindTg -18.56 989.05 -0.019 0.985
StrainPS1dE9 -16.54 989.05 -0.017 0.987
StrainWT -15.23 989.05 -0.015 0.988
HousingSTD:StraindTg 19.07 989.05 0.019 0.985
HousingSTD:StrainPS1dE9 16.49 989.05 0.017 0.987
HousingSTD:StrainWT 15.91 989.05 0.016 0.987
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 363.07 on 379 degrees of freedom
Residual deviance: 290.80 on 372 degrees of freedom
AIC: 306.8
Number of Fisher Scoring iterations: 16
exp(coef(ogreg.1725.rev.int))
(Intercept) HousingSTD StraindTg
4.254481e+07 9.401851e-08 8.705418e-09
StrainPS1dE9 StrainWT HousingSTD:StraindTg
6.581296e-08 2.428812e-07 1.914517e+08
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
1.443485e+07 8.087436e+06
impact of predictor “Strain”
pre.data.17.revs <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data.17.revs$prob <- predict(ogreg.1725.rev.int, newdata = pre.data.17.revs, type = "response")
pre.data.17.revs
Strain Housing prob
1 WT STD 0.8870968
2 WT ENR 0.9117647
3 dTg STD 0.8695652
4 dTg ENR 0.2702703
5 PS1dE9 STD 0.7916667
6 PS1dE9 ENR 0.7368421
7 APPswe STD 0.8000000
8 APPswe ENR 1.0000000
Age group 13-14 acquisition Strain x Housing
ogistic.data.acq.1314=filter(ogistic.data.1314, `_Day`=='1'|`_Day`=='2'|`_Day`=='3'|`_Day`=='4'|`_Day`=='5'|`_Day`=='6')
fitting different logistic regression models with increasing complexity simple model including housing only
ogreg.1314.acq.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = ogistic.data.acq.1314)
simple model including Strain only
ogreg.1314.acq.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = ogistic.data.acq.1314)
additive model including all factors
ogreg.1314.acq.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = ogistic.data.acq.1314)
interaction model including all factors
ogreg.1314.acq.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = ogistic.data.acq.1314)
comparisons between model using the anova function
anova(ogreg.1314.acq.add.1b, ogreg.1314.acq.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 506 643.40
2 506 691.75 0 -48.349
model with Strain only is good
anova(ogreg.1314.acq.add.2, ogreg.1314.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 505 641.78
2 506 643.40 -1 -1.6198 0.2031
adding factor housing also has good fit
anova(ogreg.1314.acq.int, ogreg.1314.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 504 638.28
2 506 643.40 -2 -5.1186 0.07736 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Strain model is best
summary of interactive model
summary(ogreg.1314.acq.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = ogistic.data.acq.1314)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.7138 -1.0447 0.7235 0.9323 1.3654
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.4318 0.1816 -2.377 0.0174 *
HousingSTD 0.1113 0.2671 0.417 0.6769
StrainWT 1.6386 0.2648 6.189 6.07e-10 ***
HousingSTD:StrainWT -0.7099 0.3800 -1.868 0.0617 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 693.42 on 507 degrees of freedom
Residual deviance: 638.28 on 504 degrees of freedom
AIC: 646.28
Number of Fisher Scoring iterations: 4
exp(coef(ogreg.1314.acq.int))
(Intercept) HousingSTD StrainWT HousingSTD:StrainWT
0.6493506 1.1177419 5.1480000 0.4916989
impact of predictors “Strain”
pre.data1314.acq <- data.frame(Strain=c("WT","WT", "dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pre.data1314.acq$prob <- predict(ogreg.1314.acq.add.1b, newdata = pre.data1314.acq, type = "response")
pre.data1314.acq
Strain Housing prob
1 WT STD 0.7153285
2 WT ENR 0.7153285
3 dTg STD 0.4059829
4 dTg ENR 0.4059829
impact of predictors “Housing”
pre.data1314.acq <- data.frame(Strain=c("WT","WT", "dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pre.data1314.acq$prob <- predict(ogreg.1314.acq.add.1a, newdata = pre.data1314.acq, type = "response")
pre.data1314.acq
Strain Housing prob
1 WT STD 0.5414847
2 WT ENR 0.5985663
3 dTg STD 0.5414847
4 dTg ENR 0.5985663
Age group 13-14 reversal Strain x Housing
ogistic.data.rev.1314=filter(ogistic.data.1314, `_Day`=='7'|`_Day`=='8'|`_Day`=='9'|`_Day`=='10')
fitting different logistic regression models with increasing complexity simple model including housing only
ogreg.1314.rev.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = ogistic.data.rev.1314)
simple model including Strain only
ogreg.1314.rev.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = ogistic.data.rev.1314)
additive model including all factors
ogreg.1314.rev.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = ogistic.data.rev.1314)
interaction model including all factors
ogreg.1314.rev.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = ogistic.data.rev.1314)
comparisons between model using the anova function
anova(ogreg.1314.rev.add.1b, ogreg.1314.rev.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 360 337.23
2 360 384.85 0 -47.62
anova(ogreg.1314.rev.add.2, ogreg.1314.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 359 337.11
2 360 337.23 -1 -0.11714 0.7322
adding factor does not improve model
anova(ogreg.1314.rev.int, ogreg.1314.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 358 333.32
2 360 337.23 -2 -3.9027 0.1421
Strain model is the best
summary of interaction model
summary(ogreg.1314.rev.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = ogistic.data.rev.1314)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.3200 0.3747 0.3747 0.9145 1.0913
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.2059 0.2277 0.904 0.3659
HousingSTD 0.4496 0.3288 1.367 0.1715
StrainWT 2.4152 0.4312 5.601 2.13e-08 ***
HousingSTD:StrainWT -1.1378 0.5884 -1.934 0.0532 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 384.89 on 361 degrees of freedom
Residual deviance: 333.32 on 358 degrees of freedom
AIC: 341.32
Number of Fisher Scoring iterations: 5
exp(coef(ogreg.1314.rev.int))
(Intercept) HousingSTD StrainWT HousingSTD:StrainWT
1.2285714 1.5676141 11.1918605 0.3205376
impact of predictors “Strain”
pre.data1314.rev <- data.frame(Strain=c("WT","WT", "dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pre.data1314.rev$prob <- predict(ogreg.1314.rev.add.1b, newdata = pre.data1314.rev, type = "response")
pre.data1314.rev
Strain Housing prob
1 WT STD 0.9073171
2 WT ENR 0.9073171
3 dTg STD 0.6050955
4 dTg ENR 0.6050955
impact of predictors “Housing”
pre.data1314.rev <- data.frame(Strain=c("WT","WT", "dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pre.data1314.rev$prob <- predict(ogreg.1314.rev.add.1a, newdata = pre.data1314.rev, type = "response")
pre.data1314.rev
Strain Housing prob
1 WT STD 0.7710843
2 WT ENR 0.7806122
3 dTg STD 0.7710843
4 dTg ENR 0.7806122
Age group 3 acquisition Strain x Housing
ogistic.data.acq.3=filter(ogistic.data.3, `_Day`=='1'|`_Day`=='2'|`_Day`=='3'|`_Day`=='4'|`_Day`=='5'|`_Day`=='6')
fitting different logistic regression models with increasing complexity simple model including housing only
ogreg.3.acq.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = ogistic.data.acq.3)
simple model including Strain only
ogreg.3.acq.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = ogistic.data.acq.3)
additive model including all factors
ogreg.3.acq.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = ogistic.data.acq.3)
interaction model including all factors
ogreg.3.acq.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = ogistic.data.acq.3)
comparisons between model using the anova function
anova(ogreg.3.acq.add.1b, ogreg.3.acq.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1398 1727.9
2 1400 1804.8 -2 -76.907 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model with Strain only is really good
anova(ogreg.3.acq.add.2, ogreg.3.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1397 1722.5
2 1398 1727.9 -1 -5.3748 0.02043 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
adding factor housing also has good fit
anova(ogreg.3.acq.int, ogreg.3.acq.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 1394 1712.5
2 1398 1727.9 -4 -15.461 0.003835 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
interaction model better than additive model interaction model is the best
summary of interaction model
summary(ogreg.3.acq.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = ogistic.data.acq.3)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.7971 -1.2746 0.7551 0.9157 1.4284
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.6523 0.1424 4.581 4.63e-06 ***
HousingSTD -0.1133 0.2203 -0.514 0.6070
StraindTg -0.4268 0.2048 -2.084 0.0372 *
StrainPS1dE9 0.4203 0.2147 1.958 0.0502 .
StrainWT 0.4566 0.2487 1.836 0.0663 .
HousingSTD:StraindTg -0.6852 0.3158 -2.170 0.0300 *
HousingSTD:StrainPS1dE9 -0.1545 0.3173 -0.487 0.6264
HousingSTD:StrainWT 0.3974 0.3519 1.129 0.2588
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1807.0 on 1401 degrees of freedom
Residual deviance: 1712.5 on 1394 degrees of freedom
AIC: 1728.5
Number of Fisher Scoring iterations: 4
exp(coef(ogreg.3.acq.int))
(Intercept) HousingSTD StraindTg
1.9200000 0.8928571 0.6526104
StrainPS1dE9 StrainWT HousingSTD:StraindTg
1.5224359 1.5787760 0.5039771
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
0.8568804 1.4879242
impact of predictors “Strain x Housing”
pre.data3.acq <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data3.acq$prob <- predict(ogreg.3.acq.int, newdata = pre.data3.acq, type = "response")
pre.data3.acq
Strain Housing prob
1 WT STD 0.8010753
2 WT ENR 0.7519380
3 dTg STD 0.3605442
4 dTg ENR 0.5561497
5 PS1dE9 STD 0.6910112
6 PS1dE9 ENR 0.7450980
7 APPswe STD 0.6315789
8 APPswe ENR 0.6575342
Age group 3 reversal Strain x Housing
ogistic.data.rev.3=filter(ogistic.data.3, `_Day`=='7'|`_Day`=='8'|`_Day`=='9'|`_Day`=='10')
fitting different logistic regression models with increasing complexity simple model including housing only
ogreg.3.rev.add.1a <- glm(strategy.class ~ Housing, family = binomial, data = ogistic.data.rev.3)
simple model including Strain only
ogreg.3.rev.add.1b <- glm(strategy.class ~ Strain, family = binomial, data = ogistic.data.rev.3)
additive model including all factors
ogreg.3.rev.add.2 <- glm(strategy.class ~ Housing + Strain, family = binomial, data = ogistic.data.rev.3)
interaction model including all factors
ogreg.3.rev.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = ogistic.data.rev.3)
comparisons between model using the anova function
anova(ogreg.3.rev.add.1b, ogreg.3.rev.add.1a, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Strain
Model 2: strategy.class ~ Housing
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 991 894.74
2 993 903.30 -2 -8.5607 0.01384 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model with Strain only is really good (Pr=3.245e-13)
anova(ogreg.3.rev.add.2, ogreg.3.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing + Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 990 894.39
2 991 894.74 -1 -0.35067 0.5537
adding factor housing also has good fit (Pr=1.945e-5)
anova(ogreg.3.rev.int, ogreg.3.rev.add.1b, test="Chisq")
Analysis of Deviance Table
Model 1: strategy.class ~ Housing * Strain
Model 2: strategy.class ~ Strain
Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1 987 889.61
2 991 894.74 -4 -5.134 0.2738
Strain is best model
summary of interaction model
summary(ogreg.3.rev.int)
Call:
glm(formula = strategy.class ~ Housing * Strain, family = binomial,
data = ogistic.data.rev.3)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.0688 0.5003 0.5769 0.6242 0.7651
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.7091 0.2371 7.207 5.73e-13 ***
HousingSTD -0.4510 0.3222 -1.400 0.1615
StraindTg -0.6303 0.3093 -2.038 0.0416 *
StrainPS1dE9 0.2681 0.3457 0.776 0.4380
StrainWT 0.3058 0.3882 0.788 0.4308
HousingSTD:StraindTg 0.9091 0.4516 2.013 0.0441 *
HousingSTD:StrainPS1dE9 0.1642 0.4789 0.343 0.7318
HousingSTD:StrainWT 0.2081 0.5168 0.403 0.6872
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 903.56 on 994 degrees of freedom
Residual deviance: 889.61 on 987 degrees of freedom
AIC: 905.61
Number of Fisher Scoring iterations: 4
exp(coef(ogreg.3.rev.int))
(Intercept) HousingSTD StraindTg
5.5238095 0.6369732 0.5324544
StrainPS1dE9 StrainWT HousingSTD:StraindTg
1.3074713 1.3577586 2.4820511
HousingSTD:StrainPS1dE9 HousingSTD:StrainWT
1.1783970 1.2313136
impact of predictors “Strain”
pre.data3.rev <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data3.rev$prob <- predict(ogreg.3.rev.add.1b, newdata = pre.data3.rev, type = "response")
pre.data3.rev
Strain Housing prob
1 WT STD 0.8675799
2 WT ENR 0.8675799
3 dTg STD 0.7813765
4 dTg ENR 0.7813765
5 PS1dE9 STD 0.8629630
6 PS1dE9 ENR 0.8629630
7 APPswe STD 0.8146718
8 APPswe ENR 0.8146718
impact of predictors “Housing”
pre.data3.rev <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data3.rev$prob <- predict(ogreg.3.rev.add.1a, newdata = pre.data3.rev, type = "response")
pre.data3.rev
Strain Housing prob
1 WT STD 0.8248945
2 WT ENR 0.8368522
3 dTg STD 0.8248945
4 dTg ENR 0.8368522
5 PS1dE9 STD 0.8248945
6 PS1dE9 ENR 0.8368522
7 APPswe STD 0.8248945
8 APPswe ENR 0.8368522
Thresholded Visualization results log. reg
2D - Age group 3
setwd("C:/Google/Uni/Bachelorarbeit/R/Analysis")
probs=read_excel("results_logistic_thresh.xlsx")
myColors = brewer.pal(4,"Set1")
myColors2= pal_npg("nrc")(3)
names(myColors)=levels(probs$Housing)
colScale=scale_colour_manual(name="Housing",values=myColors)
probs$`Experiment_Phase`=as.factor(probs$`Experiment_Phase`)
probs3=filter(probs, Age_group=='3')
gg = ggplot(probs3, mapping=aes(x=Strain, y=Probability, color=Housing)) + geom_jitter() + facet_grid(~Experiment_Phase) + labs(x="Strain", y="P(strategy.class 1)", title="Probability of 3 months old mice using Strategy class 1")
gg= gg+colScale
ggplotly(p=gg, height=400, width=800)
For ACQ Phase, Strain*Housing interaction model was used. For BOTH Phases, Strain+Housing additive model was used for predictions and for REV the simple strategy.class ~ Strain and strategy.class ~ Housing models were used separately.
2D - Age group 13-14
probs13=filter(probs, Age_group=='13-14')
gg = ggplot(probs13, mapping=aes(x=Strain, y=Probability, color=Housing)) + geom_jitter() + facet_grid(~Experiment_Phase) + labs(x="Strain", y="P(strategy.class 1)", title="Probability of 13-14 months old mice using Strategy class 1")
gg=gg+colScale
ggplotly(gg, height=400, width=800)
Strain*Housing interaction model was used for predictions of BOTH phases. In the ACQ and REV experiment phases, the simple models (strategy.class ~ Strain and strategy.class ~ Housing) showed the best fit. Take a look here
2D - Age group 17-25
probs17=filter(probs, Age_group=='17-25')
gg = ggplot(probs17, mapping=aes(x=Strain, y=Probability, color=Housing)) + geom_jitter() +scale_x_discrete(guide=guide_axis(n.dodge =2))+ facet_grid(~factor(Experiment_Phase, levels=c('ACQ','REV','BOTH'))) + labs(x="Strain", y="P(strategy.class 1)", title="Probability of 17-25 months old mice using Strategy class 1", caption="based on data from Govind & Meriem MWM Experiment in 2014")
gg=gg+colScale
gg
gg_bw=gg+theme_bw(base_size = 12)
gg_bw
gg_jco=gg_bw+scale_color_jco()
gg_jco
ggplotly(gg_jco, height=400, width=800)
For the ACQ AND BOTH phases, the simple strategy.class ~ Strain and strategy.class ~ Housing models were used and for the REV phase, the interactive Strain*Housing model showed the best fit and was therefore used for the predictions.
Publication Ready Logistic regression
Strategy Legend
- 1 - thigmotaxis
- 2 - circling
- 3 - random path
- 4 - scanning
- 5 - chaining
- 6 - directed search
- 7 - corrected search
- 8 - direct path
- 9 - perseverance
Strategies 1-5 are less hippocampus-dependent, ‘unspatial’ and therefore get strategy.class = 0. In contrast to that, strategies 6-9 are more hippocampus-dependent, ‘spatial’ and get strategy.class = 1 assigned.
All probabilities in the following codes relate to choosing strategy.class = 1.
setwd("C:/Google/Uni/Bachelorarbeit/R/Analysis")
logistic.data.pub=read_excel("logistic_reg_thresh.xlsx")
Age group 17-25 Housing
logistic.data.pub.1725=filter(logistic.data.pub, Age_group1725=='1')
interaction model including all factors
logreg.pub.1725.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.pub.1725)
interaction model
impact of predictor “Strain*Housing”
pre.data.pub.17 <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data.pub.17$prob <- predict(logreg.1725.int, newdata = pre.data.pub.17, type = "response")
pre.data.pub.17
Strain Housing prob
1 WT STD 0.5778894
2 WT ENR 0.5915493
3 dTg STD 0.3924051
4 dTg ENR 0.2982456
5 PS1dE9 STD 0.5500000
6 PS1dE9 ENR 0.4891304
7 APPswe STD 0.5641026
8 APPswe ENR 0.4675325
Age group 13-14 Strain x Housing effects
logistic.data.pub.1314=filter(logistic.data.pub, Age_group1314=='1')
interaction model including all factors
logreg.1314.pub.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.pub.1314)
impact of predictor “Strain*Housing”
pre.data.pub.1314 <- data.frame(Strain=c("WT", "WT","dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pre.data.pub.1314$prob <- predict(logreg.1314.pub.int, newdata = pre.data.pub.1314, type = "response")
pre.data.pub.1314
Strain Housing prob
1 WT STD 0.7416268
2 WT ENR 0.8407407
3 dTg STD 0.5215054
4 dTg ENR 0.4536585
Age group 3 Strain x Housing
logistic.data.pub.3=filter(logistic.data.pub, Age_group3=='1')
interaction model including all factors
logreg.pub.3.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.pub.3)
impact of predictors “Strain * Housing”
pre.data.pub.3x <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data.pub.3x$prob <- predict(logreg.pub.3.int, newdata = pre.data.pub.3x, type = "response")
pre.data.pub.3x
Strain Housing prob
1 WT STD 0.8217822
2 WT ENR 0.8095238
3 dTg STD 0.5615385
4 dTg ENR 0.6355140
5 PS1dE9 STD 0.7533333
6 PS1dE9 ENR 0.8011364
7 APPswe STD 0.6970803
8 APPswe ENR 0.7303371
Age group 17-25 acquisition Strain
logistic.data.pub.1725.acq=filter(logistic.data.pub.1725, `_Day`=='1'|`_Day`=='2'|`_Day`=='3'|`_Day`=='4'|`_Day`=='5'|`_Day`=='6')
interaction model including all factors
logreg.1725.pub.acq.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.pub.1725.acq)
impact of predictor “Strain*Housing”
pre.data.pub.17.acq <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data.pub.17.acq$prob <- predict(logreg.1725.pub.acq.int, newdata = pre.data.pub.17.acq, type = "response")
pre.data.pub.17.acq
Strain Housing prob
1 WT STD 0.6300578
2 WT ENR 0.6513158
3 dTg STD 0.2608696
4 dTg ENR 0.4090909
5 PS1dE9 STD 0.6285714
6 PS1dE9 ENR 0.6190476
7 APPswe STD 0.6153846
8 APPswe ENR 0.4571429
Age group 17-25 reversal Strain
logistic.data.pub.1725.rev=filter(logistic.data.pub.1725, `_Day`=='7'|`_Day`=='8'|`_Day`=='9'|`_Day`=='10')
interaction model including all factors
logreg.pub.1725.rev.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.pub.1725.rev)
impact of predictor “Strain*Housing”
pre.data.17.pub.revs <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data.17.pub.revs$prob <- predict(logreg.pub.1725.rev.int, newdata = pre.data.17.pub.revs, type = "response")
pre.data.17.pub.revs
Strain Housing prob
1 WT STD 0.8870968
2 WT ENR 0.9117647
3 dTg STD 0.8695652
4 dTg ENR 0.2702703
5 PS1dE9 STD 0.7916667
6 PS1dE9 ENR 0.7368421
7 APPswe STD 0.8000000
8 APPswe ENR 1.0000000
Age group 13-14 acquisition Strain x Housing
logistic.data.pub.acq.1314=filter(logistic.data.pub.1314, `_Day`=='1'|`_Day`=='2'|`_Day`=='3'|`_Day`=='4'|`_Day`=='5'|`_Day`=='6')
interaction model including all factors
logreg.pub.1314.acq.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.pub.acq.1314)
impact of predictors “Strain”
pre.data.pub.1314.acq <- data.frame(Strain=c("WT","WT", "dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pre.data.pub.1314.acq$prob <- predict(logreg.pub.1314.acq.int, newdata = pre.data.pub.1314.acq, type = "response")
pre.data.pub.1314.acq
Strain Housing prob
1 WT STD 0.6475410
2 WT ENR 0.7697368
3 dTg STD 0.4205607
4 dTg ENR 0.3937008
Age group 13-14 reversal Strain x Housing
logistic.data.pub.rev.1314=filter(logistic.data.pub.1314, `_Day`=='7'|`_Day`=='8'|`_Day`=='9'|`_Day`=='10')
interaction model including all factors
logreg.pub.1314.rev.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.pub.rev.1314)
impact of predictors “Strain”
pre.data.pub.1314.rev <- data.frame(Strain=c("WT","WT", "dTg","dTg"),Housing=c("STD","ENR","STD","ENR"))
pre.data.pub.1314.rev$prob <- predict(logreg.pub.1314.rev.int, newdata = pre.data.pub.1314.rev, type = "response")
pre.data.pub.1314.rev
Strain Housing prob
1 WT STD 0.8735632
2 WT ENR 0.9322034
3 dTg STD 0.6582278
4 dTg ENR 0.5512821
Age group 3 acquisition Strain x Housing
logistic.data.pub.acq.3=filter(logistic.data.pub.3, `_Day`=='1'|`_Day`=='2'|`_Day`=='3'|`_Day`=='4'|`_Day`=='5'|`_Day`=='6')
interaction model including all factors
logreg.pub.3.acq.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.pub.acq.3)
impact of predictors “Strain x Housing”
pre.data.pub.3.acq <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data.pub.3.acq$prob <- predict(logreg.pub.3.acq.int, newdata = pre.data.pub.3.acq, type = "response")
pre.data.pub.3.acq
Strain Housing prob
1 WT STD 0.8010753
2 WT ENR 0.7519380
3 dTg STD 0.3605442
4 dTg ENR 0.5561497
5 PS1dE9 STD 0.6910112
6 PS1dE9 ENR 0.7450980
7 APPswe STD 0.6315789
8 APPswe ENR 0.6575342
Age group 3 reversal Strain x Housing
logistic.data.pub.rev.3=filter(logistic.data.pub.3, `_Day`=='7'|`_Day`=='8'|`_Day`=='9'|`_Day`=='10')
interaction model including all factors
logreg.pub.3.rev.int <- glm(strategy.class ~ Housing * Strain, family = binomial, data = logistic.data.pub.rev.3)
impact of predictors “Strain x Housing”
pre.data.pub.3.rev <- data.frame(Strain=c("WT","WT", "dTg","dTg", "PS1dE9","PS1dE9", "APPswe","APPswe"),Housing=c("STD","ENR","STD","ENR","STD","ENR","STD","ENR"))
pre.data.pub.3.rev$prob <- predict(logreg.pub.3.rev.int, newdata = pre.data.pub.3.rev, type = "response")
pre.data.pub.3.rev
Strain Housing prob
1 WT STD 0.8547009
2 WT ENR 0.8823529
3 dTg STD 0.8230088
4 dTg ENR 0.7462687
5 PS1dE9 STD 0.8442623
6 PS1dE9 ENR 0.8783784
7 APPswe STD 0.7786885
8 APPswe ENR 0.8467153
Publication Ready Visualization results log. reg
2D - Age group 3
setwd("C:/Google/Uni/Bachelorarbeit/R/Analysis")
probs.pub=read_excel("results_logistic_thresh_pub.xlsx")
myColors = brewer.pal(4,"Set1")
myColors2= pal_npg("nrc")(3)
names(myColors)=levels(probs.pub$Housing)
colScale=scale_colour_manual(name="Housing",values=myColors)
probs.pub$`Experiment_Phase`=as.factor(probs.pub$`Experiment_Phase`)
probs.pub3=filter(probs.pub, Age_group=='3')
gg = ggplot(probs.pub3, mapping=aes(x=Strain, y=Probability, color=Housing)) + geom_point() + facet_grid(~factor(Experiment_Phase, levels=c('ACQ','REV','BOTH'))) + labs(x="Strain", y="P(strategy.class 1)", title="Probability of 3 months old mice using Strategy class 1")
gg= gg+colScale
gg_bw=gg+theme_bw(base_size = 12)
gg_bw
ggplotly(p=gg, height=400, width=800)
2D - Age group 13-14
probs.pub13=filter(probs.pub, Age_group=='13-14')
gg = ggplot(probs.pub13, mapping=aes(x=Strain, y=Probability, color=Housing)) + geom_point() + facet_grid(~factor(Experiment_Phase, levels=c('ACQ','REV','BOTH'))) + labs(x="Strain", y="P(strategy.class 1)", title="Probability of 13-14 months old mice using Strategy class 1")
gg=gg+colScale
ggplotly(gg, height=400, width=800)
2D - Age group 17-25
probs.pub17=filter(probs.pub, Age_group=='17-25')
gg = ggplot(probs.pub17, mapping=aes(x=Strain, y=Probability, color=Housing)) + geom_point() +scale_x_discrete(guide=guide_axis(n.dodge =2))+ facet_grid(~factor(Experiment_Phase, levels=c('ACQ','REV','BOTH'))) + labs(x="Strain", y="P(strategy.class 1)", title="Probability of 17-25 months old mice using Strategy class 1", caption="based on data from Govind & Meriem MWM Experiment in 2014")
gg=gg+colScale
gg
gg_bw=gg+theme_bw(base_size = 12)
gg_bw
gg_jco=gg_bw+scale_color_jco()
gg_jco
ggplotly(gg_jco, height=400, width=800)
#Prediction Model explanation
Algorithm of strategy calling:
The Rtrack algorithm was exclusively trained with data from Morris water maze experiments with mice of different sex and genotypes, where multiple experts visually classified images of swim paths into different search strategies. Those 9 search strategies followed the scheme described at Rtrack Documentation - Strategy description and were classified at least twice until no discrepancies in the called strategies were left. Cases, in which the swim path could not be decided without doubt due to a mixture of strategies in one path or due to none of the 9 strategies being adequate, were discarded.
We then assigned each track the strategy class 0 or 1 depending on their hippocampus-dependency. The assignment was done following figure 3 in Garthe et. al. 2016, where ‘unspatial’ strategies were labled with strategy class 0 and ‘spatial’ strategies were labled with class 1.(Garthe et al., 2016)
Strategy.class
We´ve then done a logistic regression, which is a statistical model for a regression analysis. To do this, we first applied different logistic regression models with increasing complexity to our data and compared them using the ANOVA function. With this we choose the minimal adequate model, which is the simplest model, that describes the data appropiatly. With this model, we then could compute a prediction, which is the propability of a mouse of a specific experiment paradigm, choosing strategy class 1 and therefore using a hippocampus dependent strategy.
As the machine-learning algorithm of RTrack
always chooses a strategy for a Trial, even if the algorithm is not quite sure, there are a lot of strategy calls, that the algorithm does not have a high confidence in. It therefore is of interest to only choose and only work with data, where a certain confidence threshold is given.
We have observed during testing that confidence scores above 0.4 are typically accurate and reproducible
RTrack - Documentation(Overall, 2020)
Following the recomendation of the RTrack
documentation, a confidence threshold of 0.4 was choosen, which means that all strategies that did not were called with a confidence of 0.4 or higher, were discarded.(Overall, 2020)
Publication Ready Plots
setwd("C:/Google/Uni/Bachelorarbeit/R/Analysis")
Results=read_excel("Results3.xlsx", col_types=c("text","text","text","text","text","text","logical","numeric","text","text","text","numeric","text","numeric","text","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric"))
mo3=filter(Results, Age_group=='3')
mo14=filter(Results, Age_group=='13-14')
mo25=filter(Results, Age_group=='17-25')
mo3.probe=filter(Results, Age_group=='3'&Probe=='TRUE')
mo14.probe=filter(Results, Age_group=='13-14'&Probe=='TRUE')
mo25.probe=filter(Results, Age_group=='17-25'&Probe=='TRUE')
Results.paper=filter(Results, Age_group=='3'|Age_group=='13-14' )
Results.paper.probe=filter(Results.paper, Probe=='TRUE')
13-14 Velocity Plot
mo14 %>%
mutate(mo14, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=mean.velocity, ,group=Condition))+
geom_line(stat="summary", fun.y=mean,aes(linetype=Condition), size=1)+
geom_point(stat="summary", fun.y=mean,aes(shape=Condition),size=2)+
scale_colour_grey()+
scale_shape_manual(values=c(16,1,17,2))+
scale_linetype_manual(values=c(1,1,2,2))+
stat_summary(fun.data = mean_se, geom = "errorbar")+
labs(x="Day",
y="Average Velocity [cm/s]",
title="Mean Velocity 13-14mo mice")+theme_bw(base_size = 12)
## 3 mo Velocity Plot{#anchor54.15}
mo3 %>%
mutate(mo3, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=mean.velocity, ,group=Condition))+
geom_line(stat="summary", fun.y=mean,aes(linetype=Condition), size=1)+
geom_point(stat="summary", fun.y=mean,aes(shape=Condition),size=2)+
scale_colour_grey()+
scale_shape_manual(values=c(16,1,17,2,15,0,18,5))+
scale_linetype_manual(values=c(1,1,2,2,3,3,4,4))+
stat_summary(fun.data = mean_se, geom = "errorbar",size=.5)+
labs(x="Day",
y="Average Velocity [cm/s]",
title="Mean Velocity 3 mo mice")+theme_bw(base_size = 12)
## Velocity Plots box{#anchor54.17}
Results.paper %>%
ggplot(aes(x=`Age_group`,y=mean.velocity,fill=Age_group))+
geom_boxplot()+
scale_fill_brewer(palette="Greys")+
scale_x_discrete(limits=c("3", "13-14"))+
theme_classic(base_size = 12)+
theme(legend.position = c(.5, .8))+
labs(x="Age in months",
y="Average Velocity [cm/s]",
title="Mean Velocity all mice",
fill="Age group")
## Latency Plots 13/14 {#anchor54.2}
mo14 %>%
mutate(mo14, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, ,group=Condition))+
geom_line(stat="summary", fun.y=mean,aes(linetype=Condition), size=1)+
geom_point(stat="summary", fun.y=mean,aes(shape=Condition),size=2)+
scale_colour_grey()+
scale_shape_manual(values=c(16,1,17,2,15,0,18,5))+
scale_linetype_manual(values=c(1,1,2,2,3,3,4,4))+
stat_summary(fun.data = mean_se, geom = "errorbar",size=.5)+
theme_classic(base_size = 12)+
geom_vline(xintercept =7, linetype="dotted",
color = "black", size=.5)+
labs(x="Day",
y="Latency [s]",
title="Mean Latency to goal 13-14mo mice")
Latency Plot 3
mo3 %>%
mutate(mo3, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=latency.to.goal, ,group=Condition))+
geom_line(stat="summary", fun.y=mean,aes(linetype=Condition), size=1)+
geom_point(stat="summary", fun.y=mean,aes(shape=Condition),size=2)+
scale_colour_grey()+
scale_shape_manual(values=c(16,1,17,2,15,0,18,5))+
scale_linetype_manual(values=c(1,1,2,2,3,3,4,4))+
stat_summary(fun.data = mean_se, geom = "errorbar",size=.5)+
theme_classic(base_size = 12)+
geom_vline(xintercept =7, linetype="dotted",
color = "black", size=.5)+
labs(x="Day",
y="Latency [s]",
title="Mean Latency to goal 3mo mice")
Mean Path Length Plots 13
mo14 %>%
mutate(mo14, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, ,group=Condition))+
geom_line(stat="summary", fun.y=mean,aes(linetype=Condition), size=1)+
geom_point(stat="summary", fun.y=mean,aes(shape=Condition),size=2)+
scale_colour_grey()+
scale_shape_manual(values=c(16,1,17,2,15,0,18,5))+
scale_linetype_manual(values=c(1,1,2,2,3,3,4,4))+
stat_summary(fun.data = mean_se, geom = "errorbar",size=.5)+
theme_classic(base_size = 12)+
geom_vline(xintercept =7, linetype="dotted",
color = "black", size=.5)+
labs(x="Day",
y="Path length [cm]",
title="Mean Path Length 13-14mo mice")
Mean Path Length Plots 3
mo3 %>%
mutate(mo3, `_Day`=fct_relevel(`_Day`,"1","2","3","4","5","6","7","8","9","10"))%>%
ggplot(aes(x=`_Day`,y=path.length, ,group=Condition))+
geom_line(stat="summary", fun.y=mean,aes(linetype=Condition), size=1)+
geom_point(stat="summary", fun.y=mean,aes(shape=Condition),size=2)+
scale_colour_grey()+
scale_shape_manual(values=c(16,1,17,2,15,0,18,5))+
scale_linetype_manual(values=c(1,1,2,2,3,3,4,4))+
stat_summary(fun.data = mean_se, geom = "errorbar",size=.5)+
theme_classic(base_size = 12)+
geom_vline(xintercept =7, linetype="dotted",
color = "black", size=.5)+
labs(x="Day",
y="Path length [cm]",
title="Mean Path Length 3mo mice")
Probe Trial time in goal quadrant Plots
mo14.probe %>%
ggplot(aes(x='',y=time.in.zone.n.quadrant, ,group=Condition,fill=Condition))+
geom_boxplot()+
scale_fill_brewer(palette="Greys")+
theme_classic(base_size = 12)+
labs(x="Condition",
y="Time [s]",
title="Probe Trial time in goal quadrant 13-14mo mice")
Probe Trial time in old goal zone Plots
mo14.probe %>%
ggplot(aes(x='',y=time.in.zone.old.goal, ,group=Condition,fill=Condition))+
geom_boxplot()+
scale_fill_brewer(palette="Greys")+
theme_classic(base_size = 12)+
labs(x="Condition",
y="Time [s]",
title="Probe Trial time in old goal zone 13-14mo mice")
Probe Trial distance to old goal Plots
mo14.probe %>%
ggplot(aes(x='',y=mean.d.old.goal, ,group=Condition,fill=Condition))+
geom_boxplot()+
scale_fill_brewer(palette="Greys")+
theme_classic(base_size = 12)+
labs(x="Condition",
y="Distance [cm]",
title="Probe Trial mean distance to old goal 13-14mo mice")
13mo Probe Trial old goal crossings Plots
mo14.probe %>%
ggplot(aes(x='',y=old.goal.crossings, ,group=Condition,fill=Housing))+
geom_boxplot()+
scale_fill_brewer(palette="Greys")+
theme_classic(base_size = 12)+
theme(legend.position = c(.5, .7))+
facet_grid(~Strain)+
labs(x="Condition",
y="Number of goal crossings",
title="Probe Trial old goal crossings 13-14mo mice")
3mo Probe Trial old goal crossings Plots
mo3.probe %>%
ggplot(aes(x='',y=old.goal.crossings, ,group=Condition,fill=Housing))+
geom_boxplot()+
scale_fill_brewer(palette="Greys")+
theme_classic(base_size = 12)+
theme(legend.position = "none")+
facet_grid(~Strain)+
labs(x="Condition",
y="Number of goal crossings",
title="Probe Trial old goal crossings 3mo mice")
Facet grid old goal crossings Plot
Results.paper.probe %>%
ggplot(aes(x='Condition',y=old.goal.crossings, ,group=Condition,fill=Condition))+
geom_boxplot()+
scale_fill_brewer(palette="Greys")+
theme_classic(base_size = 12)+
facet_grid(~factor(Age_group))+
labs(x="Condition",
y="Goal crossings",
title="Probe Trial old goal crossings all mice")
## Visualization
probs.pub.red=filter(probs.pub, Age_group=='3'|Age_group=='13-14')
probs.pub3=mutate(probs.pub3, `Strain`=fct_relevel(`Strain`,"WT","dTg","APPswe","PS1dE9"))
probs.pub13=mutate(probs.pub13, `Strain`=fct_relevel(`Strain`,"WT","dTg","APPswe","PS1dE9"))
probs.pub.red %>%
mutate(probs.pub.red, `Strain`=fct_relevel(`Strain`,"WT","dTg","APPswe","PS1dE9"))%>%
ggplot()+
geom_segment(data=probs.pub3, aes(x=Strain,xend=Strain, y=0.5,yend=Probability,color=Age_group))+
geom_segment(data=probs.pub13, aes(x=Strain,xend=Strain, y=0.5,yend=Probability,color=Age_group))+
geom_point(data=probs.pub.red, aes(x=Strain,y=Probability,color=Age_group,shape=Housing),size=2)+
facet_grid(~factor(Experiment_Phase, levels=c('ACQ','REV','BOTH')))+
scale_shape_manual(values=c(16,1))+
coord_flip()+
geom_hline(yintercept = .5, linetype="dotted",
color = "red", size=.5)
Statistics
test.aov2 = aov(path.length ~ Housing + Strain, data=Results.paper)
summary(test.aov2)
Df Sum Sq Mean Sq F value Pr(>F)
Housing 1 910416 910416 5.20 0.0226 *
Strain 3 40160522 13386841 76.46 <2e-16 ***
Residuals 4643 812943650 175090
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
2-Way ANOVA (path length)
3 & 13-14 additive
test.aov2 = aov(path.length ~ Housing + Strain, data=Results.paper)
summary(test.aov2)
Df Sum Sq Mean Sq F value Pr(>F)
Housing 1 910416 910416 5.20 0.0226 *
Strain 3 40160522 13386841 76.46 <2e-16 ***
Residuals 4643 812943650 175090
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
3 additive
test.aov2 = aov(path.length ~ Housing + Strain, data=mo3)
summary(test.aov2)
Df Sum Sq Mean Sq F value Pr(>F)
Housing 1 500116 500116 2.719 0.0993 .
Strain 3 27147549 9049183 49.189 <2e-16 ***
Residuals 3335 613532155 183968
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
13-14 additive
test.aov2 = aov(path.length ~ Housing + Strain, data=mo14)
summary(test.aov2)
Df Sum Sq Mean Sq F value Pr(>F)
Housing 1 410701 410701 2.70 0.101
Strain 1 12999875 12999875 85.46 <2e-16 ***
Residuals 1305 198501886 152109
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
3 & 13-14 interactive
test.aov2 = aov(path.length ~ Housing * Strain, data=Results.paper)
summary(test.aov2)
Df Sum Sq Mean Sq F value Pr(>F)
Housing 1 910416 910416 5.205 0.0226 *
Strain 3 40160522 13386841 76.534 <2e-16 ***
Housing:Strain 3 1349463 449821 2.572 0.0524 .
Residuals 4640 811594187 174913
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Different levels
of Strain are associated with significant different path length.
P-value for the interaction between Housing*Strain is … –> relationship between Housing and Strain depends on the Housing method
1-Way ANOVA Strain (path length)
3 & 13-14 Strain
test.aov2 = aov(path.length ~ Strain, data=Results.paper)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = path.length ~ Strain, data = Results.paper)
$Strain
diff lwr upr p adj
dTg-APPswe 45.44426 -0.644866 91.533382 0.0549619
PS1dE9-APPswe -127.95856 -179.724310 -76.192806 0.0000000
WT-APPswe -165.53020 -211.942750 -119.117655 0.0000000
PS1dE9-dTg -173.40282 -219.374094 -127.431538 0.0000000
WT-dTg -210.97446 -250.821542 -171.127378 0.0000000
WT-PS1dE9 -37.57164 -83.867169 8.723881 0.1578826
3 Strain
test.aov2 = aov(path.length ~ Strain, data=mo3)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = path.length ~ Strain, data = mo3)
$Strain
diff lwr upr p adj
dTg-APPswe 63.35563 10.11501 116.59624 0.0120108
PS1dE9-APPswe -127.95856 -181.02983 -74.88728 0.0000000
WT-APPswe -153.01281 -208.04572 -97.97990 0.0000000
PS1dE9-dTg -191.31418 -244.44760 -138.18077 0.0000000
WT-dTg -216.36843 -271.46127 -161.27559 0.0000000
WT-PS1dE9 -25.05425 -79.98346 29.87496 0.6443806
13-14 Strain
test.aov2 = aov(path.length ~ Strain, data=mo14)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = path.length ~ Strain, data = mo14)
$Strain
diff lwr upr p adj
WT-dTg -200.5298 -242.8829 -158.1767 0
1-Way ANOVA Housing (path length)
3 & 13-14 Housing
test.aov2 = aov(path.length ~ Housing, data=Results.paper)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = path.length ~ Housing, data = Results.paper)
$Housing
diff lwr upr p adj
STD-ENR 27.99092 3.346423 52.63543 0.0260162
differences for 3 & 13-14 Model depend on age group differences
3 Housing
test.aov2 = aov(path.length ~ Housing, data=mo3)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = path.length ~ Housing, data = mo3)
$Housing
diff lwr upr p adj
STD-ENR 24.47414 -5.253121 54.20141 0.1065779
13-14 Housing
test.aov2 = aov(path.length ~ Housing, data=mo14)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = path.length ~ Housing, data = mo14)
$Housing
diff lwr upr p adj
STD-ENR 35.45162 -8.220986 79.12422 0.1115158
1-Way ANOVA Strain (latency.to.goal)
3 & 13-14 Strain
test.aov2 = aov(latency.to.goal ~ Strain, data=Results.paper)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = latency.to.goal ~ Strain, data = Results.paper)
$Strain
diff lwr upr p adj
dTg-APPswe 2.9539383 0.5612266 5.346650 0.0082934
PS1dE9-APPswe -1.3626485 -3.9284678 1.203171 0.5212776
WT-APPswe -0.5432859 -2.8367711 1.750199 0.9292354
PS1dE9-dTg -4.3165868 -6.6435341 -1.989639 0.0000117
WT-dTg -3.4972242 -5.5199277 -1.474521 0.0000545
WT-PS1dE9 0.8193626 -1.4054271 3.044152 0.7794800
3 Strain
test.aov2 = aov(latency.to.goal ~ Strain, data=mo3)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = latency.to.goal ~ Strain, data = mo3)
$Strain
diff lwr upr p adj
dTg-APPswe 1.9804372 -0.6332665 4.5941410 0.2082427
PS1dE9-APPswe -1.3626485 -3.8494681 1.1241710 0.4936757
WT-APPswe -2.2364633 -4.8422987 0.3693722 0.1216564
PS1dE9-dTg -3.3430857 -5.9004049 -0.7857666 0.0044038
WT-dTg -4.2169005 -6.8900986 -1.5437024 0.0003045
WT-PS1dE9 -0.8738147 -3.4230915 1.6754621 0.8144416
13-14 Strain
test.aov2 = aov(latency.to.goal ~ Strain, data=mo14)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = latency.to.goal ~ Strain, data = mo14)
$Strain
diff lwr upr p adj
WT-dTg -3.371044 -5.823162 -0.9189257 0.0071299
1-Way ANOVA Housing (Latency)
3 & 13-14 Housing
test.aov2 = aov(latency.to.goal ~ Housing, data=Results.paper)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = latency.to.goal ~ Housing, data = Results.paper)
$Housing
diff lwr upr p adj
STD-ENR 0.8123548 -0.4031149 2.027824 0.1901065
differences for 3 & 13-14 Model depend on age group differences
3 Housing
test.aov2 = aov(latency.to.goal ~ Housing, data=mo3)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = latency.to.goal ~ Housing, data = mo3)
$Housing
diff lwr upr p adj
STD-ENR 0.3321392 -1.065987 1.730265 0.6412935
13-14 Housing
test.aov2 = aov(latency.to.goal ~ Housing, data=mo14)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = latency.to.goal ~ Housing, data = mo14)
$Housing
diff lwr upr p adj
STD-ENR 1.959837 -0.4356974 4.355371 0.108644
1-Way ANOVA Strain (mean.velocity)
Age groups
test.aov2 = aov(mean.velocity ~ Age_group, data=Results.paper)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = mean.velocity ~ Age_group, data = Results.paper)
$Age_group
diff lwr upr p adj
3-13-14 1.627529 1.422214 1.832843 0
t.test(mo3$mean.velocity,mo14$mean.velocity)
Welch Two Sample t-test
data: mo3$mean.velocity and mo14$mean.velocity
t = 14.959, df = 2213.9, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
1.414162 1.840895
sample estimates:
mean of x mean of y
19.97146 18.34393
3 & 13-14 Strain
test.aov2 = aov(mean.velocity ~ Strain, data=Results.paper)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = mean.velocity ~ Strain, data = Results.paper)
$Strain
diff lwr upr p adj
dTg-APPswe -1.2617890 -1.61988272 -0.9036953 0.0000000
PS1dE9-APPswe -0.9350315 -1.33723032 -0.5328327 0.0000001
WT-APPswe -1.4216009 -1.78220752 -1.0609944 0.0000000
PS1dE9-dTg 0.3267575 -0.03042061 0.6839356 0.0869404
WT-dTg -0.1598119 -0.46940751 0.1497837 0.5459349
WT-PS1dE9 -0.4865694 -0.84626676 -0.1268721 0.0028827
3 Strain
test.aov2 = aov(mean.velocity ~ Strain, data=mo3)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = mean.velocity ~ Strain, data = mo3)
$Strain
diff lwr upr p adj
dTg-APPswe -0.5364440 -0.9219577 -0.15093034 0.0020008
PS1dE9-APPswe -0.9350315 -1.3193190 -0.55074404 0.0000000
WT-APPswe -0.7868209 -1.1853126 -0.38832931 0.0000024
PS1dE9-dTg -0.3985875 -0.7833250 -0.01385006 0.0389386
WT-dTg -0.2503769 -0.6493025 0.14854864 0.3712151
WT-PS1dE9 0.1482106 -0.2495302 0.54595133 0.7734230
13-14 Strain
test.aov2 = aov(mean.velocity ~ Strain, data=mo14)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = mean.velocity ~ Strain, data = mo14)
$Strain
diff lwr upr p adj
WT-dTg 0.1209523 -0.2497204 0.4916249 0.5221946
1-Way ANOVA Housing (mean.velocity)
3 & 13-14 Housing
test.aov2 = aov(mean.velocity ~ Housing, data=Results.paper)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = mean.velocity ~ Housing, data = Results.paper)
$Housing
diff lwr upr p adj
STD-ENR -1.117417 -1.304064 -0.9307707 0
differences for 3 & 13-14 Model depend on age group differences
3 Housing
test.aov2 = aov(mean.velocity ~ Housing, data=mo3)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = mean.velocity ~ Housing, data = mo3)
$Housing
diff lwr upr p adj
STD-ENR -1.260436 -1.468341 -1.052532 0
13-14 Housing
test.aov2 = aov(mean.velocity ~ Housing, data=mo14)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = mean.velocity ~ Housing, data = mo14)
$Housing
diff lwr upr p adj
STD-ENR -0.8334084 -1.201243 -0.4655739 9.5e-06
1-Way ANOVA Strain (time.in.zone.n.quadrant)
3 & 13-14 Strain
test.aov2 = aov(time.in.zone.n.quadrant ~ Strain, data=Results.paper.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = time.in.zone.n.quadrant ~ Strain, data = Results.paper.probe)
$Strain
diff lwr upr p adj
dTg-APPswe 1.1813129 -1.745700 4.10832546 0.7190474
PS1dE9-APPswe -0.8469094 -4.141153 2.44733454 0.9080825
WT-APPswe -1.4055409 -4.362215 1.55113353 0.6031783
PS1dE9-dTg -2.0282223 -4.955235 0.89879023 0.2755271
WT-dTg -2.5868538 -5.127972 -0.04573536 0.0443494
WT-PS1dE9 -0.5586315 -3.515306 2.39804292 0.9605922
3 Strain
test.aov2 = aov(time.in.zone.n.quadrant ~ Strain, data=mo3.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = time.in.zone.n.quadrant ~ Strain, data = mo3.probe)
$Strain
diff lwr upr p adj
dTg-APPswe 0.8958154 -2.538977 4.330608 0.9028551
PS1dE9-APPswe -0.8469094 -4.281702 2.587883 0.9163777
WT-APPswe -1.4680769 -5.035878 2.099724 0.7030402
PS1dE9-dTg -1.7427247 -5.177517 1.692068 0.5461412
WT-dTg -2.3638923 -5.931694 1.203909 0.3110092
WT-PS1dE9 -0.6211676 -4.188969 2.946634 0.9681346
13-14 Strain
test.aov2 = aov(time.in.zone.n.quadrant ~ Strain, data=mo14.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = time.in.zone.n.quadrant ~ Strain, data = mo14.probe)
$Strain
diff lwr upr p adj
WT-dTg -2.90952 -5.674772 -0.1442675 0.0398197
1-Way ANOVA Housing (time.in.zone.n.quadrant)
3 & 13-14 Housing
test.aov2 = aov(time.in.zone.n.quadrant ~ Housing, data=Results.paper.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = time.in.zone.n.quadrant ~ Housing, data = Results.paper.probe)
$Housing
diff lwr upr p adj
STD-ENR -0.8546631 -2.411818 0.7024919 0.2792506
differences for 3 & 13-14 Model depend on age group differences
3 Housing
test.aov2 = aov(time.in.zone.n.quadrant ~ Housing, data=mo3.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = time.in.zone.n.quadrant ~ Housing, data = mo3.probe)
$Housing
diff lwr upr p adj
STD-ENR -1.345329 -3.213081 0.522423 0.1557181
13-14 Housing
test.aov2 = aov(time.in.zone.n.quadrant ~ Housing, data=mo14.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = time.in.zone.n.quadrant ~ Housing, data = mo14.probe)
$Housing
diff lwr upr p adj
STD-ENR 0.4327593 -2.526527 3.392045 0.7674994
1-Way ANOVA Strain (old.goal.crossings)
3 & 13-14 Strain
test.aov2 = aov(old.goal.crossings ~ Strain, data=Results.paper.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = old.goal.crossings ~ Strain, data = Results.paper.probe)
$Strain
diff lwr upr p adj
dTg-APPswe 0.22009569 -1.2642724 1.704464 0.9802698
PS1dE9-APPswe 0.27272727 -1.3978739 1.943328 0.9739824
WT-APPswe 0.88383838 -0.6155720 2.383249 0.4190188
PS1dE9-dTg 0.05263158 -1.4317365 1.537000 0.9997153
WT-dTg 0.66374269 -0.6249279 1.952413 0.5377063
WT-PS1dE9 0.61111111 -0.8882993 2.110522 0.7128503
3 Strain
test.aov2 = aov(old.goal.crossings ~ Strain, data=mo3.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = old.goal.crossings ~ Strain, data = mo3.probe)
$Strain
diff lwr upr p adj
dTg-APPswe 0.7272727 -0.8823957 2.336941 0.6378999
PS1dE9-APPswe 0.2727273 -1.3369412 1.882396 0.9705081
WT-APPswe 1.0095694 -0.6624317 2.681570 0.3934796
PS1dE9-dTg -0.4545455 -2.0642139 1.155123 0.8803218
WT-dTg 0.2822967 -1.3897045 1.954298 0.9708014
WT-PS1dE9 0.7368421 -0.9351590 2.408843 0.6560857
13-14 Strain
test.aov2 = aov(old.goal.crossings ~ Strain, data=mo14.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = old.goal.crossings ~ Strain, data = mo14.probe)
$Strain
diff lwr upr p adj
WT-dTg 1.220588 -0.4195092 2.860686 0.1391879
1-Way ANOVA Housing (old.goal.crossings)
3 & 13-14 Housing
test.aov2 = aov(old.goal.crossings ~ Housing, data=Results.paper.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = old.goal.crossings ~ Housing, data = Results.paper.probe)
$Housing
diff lwr upr p adj
STD-ENR -0.06779661 -0.8459462 0.7103529 0.8632957
differences for 3 & 13-14 Model depend on age group differences
3 Housing
test.aov2 = aov(old.goal.crossings ~ Housing, data=mo3.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = old.goal.crossings ~ Housing, data = mo3.probe)
$Housing
diff lwr upr p adj
STD-ENR -0.05204873 -0.9357565 0.8316591 0.9070274
13-14 Housing
test.aov2 = aov(old.goal.crossings ~ Housing, data=mo14.probe)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = old.goal.crossings ~ Housing, data = mo14.probe)
$Housing
diff lwr upr p adj
STD-ENR -0.1286765 -1.827972 1.570619 0.8782648
1-Way ANOVA Strain (Strategy probabilities)
3 & 13-14 Strain
test.aov2 = aov(Probability ~ Strain, data=probs.pub.red)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Strain, data = probs.pub.red)
$Strain
diff lwr upr p adj
dTg-APPswe -0.16682578 -0.30604859 -0.02760298 0.0138524
PS1dE9-APPswe 0.06188088 -0.09887977 0.22264153 0.7258189
WT-APPswe 0.08690970 -0.05231311 0.22613251 0.3447381
PS1dE9-dTg 0.22870667 0.08948386 0.36792947 0.0005392
WT-dTg 0.25373548 0.14006054 0.36741043 0.0000055
WT-PS1dE9 0.02502882 -0.11419399 0.16425162 0.9614178
13-14 ACQ
probs.pub13.ACQ=filter(probs.pub13, Experiment_Phase=='ACQ')
test.aov2 = aov(Probability ~ Strain, data=probs.pub13.ACQ)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Strain, data = probs.pub13.ACQ)
$Strain
diff lwr upr p adj
dTg-WT -0.3015081 -0.5704356 -0.03258066 0.0403636
13-14 REV
probs.pub13.REV=filter(probs.pub13, Experiment_Phase=='REV')
test.aov2 = aov(Probability ~ Strain, data=probs.pub13.REV)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Strain, data = probs.pub13.REV)
$Strain
diff lwr upr p adj
dTg-WT -0.2981283 -0.5602945 -0.03596222 0.0392964
13-14 BOTH
probs.pub13.BOTH=filter(probs.pub13, Experiment_Phase=='BOTH')
test.aov2 = aov(Probability ~ Strain, data=probs.pub13.BOTH)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Strain, data = probs.pub13.BOTH)
$Strain
diff lwr upr p adj
dTg-WT -0.3036018 -0.5617786 -0.04542501 0.0368786
3 ACQ
probs.pub3.ACQ=filter(probs.pub3, Experiment_Phase=='ACQ')
test.aov2 = aov(Probability ~ Strain, data=probs.pub3.ACQ)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Strain, data = probs.pub3.ACQ)
$Strain
diff lwr upr p adj
dTg-WT -0.31815970 -0.62100452 -0.01531488 0.0426123
APPswe-WT -0.13195010 -0.43479492 0.17089472 0.3994255
PS1dE9-WT -0.05845205 -0.36129687 0.24439277 0.8578911
APPswe-dTg 0.18620960 -0.11663522 0.48905442 0.1981976
PS1dE9-dTg 0.25970765 -0.04313717 0.56255247 0.0805592
PS1dE9-APPswe 0.07349805 -0.22934677 0.37634287 0.7644938
3 REV
probs.pub3.REV=filter(probs.pub3, Experiment_Phase=='REV')
test.aov2 = aov(Probability ~ Strain, data=probs.pub3.REV)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Strain, data = probs.pub3.REV)
$Strain
diff lwr upr p adj
dTg-WT -0.08388815 -0.24444990 0.0766736 0.2848200
APPswe-WT -0.05582500 -0.21638675 0.1047368 0.5523161
PS1dE9-WT -0.00720655 -0.16776830 0.1533552 0.9974812
APPswe-dTg 0.02806315 -0.13249860 0.1886249 0.8879030
PS1dE9-dTg 0.07668160 -0.08388015 0.2372434 0.3396523
PS1dE9-APPswe 0.04861845 -0.11194330 0.2091802 0.6416882
3 BOTH
probs.pub3.BOTH=filter(probs.pub3, Experiment_Phase=='BOTH')
test.aov2 = aov(Probability ~ Strain, data=probs.pub3.BOTH)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Strain, data = probs.pub3.BOTH)
$Strain
diff lwr upr p adj
dTg-WT -0.21712675 -0.35377198 -0.08048152 0.0101002
APPswe-WT -0.10194430 -0.23858953 0.03470093 0.1203041
PS1dE9-WT -0.03841815 -0.17506338 0.09822708 0.6861155
APPswe-dTg 0.11518245 -0.02146278 0.25182768 0.0847954
PS1dE9-dTg 0.17870860 0.04206337 0.31535383 0.0202723
PS1dE9-APPswe 0.06352615 -0.07311908 0.20017138 0.3568552
1-Way ANOVA Housing (Strategy probabilities)
3 & 13-14 Housing
test.aov2 = aov(Probability ~ Housing, data=probs.pub.red)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Housing, data = probs.pub.red)
$Housing
diff lwr upr p adj
STD-ENR -0.02781331 -0.1296917 0.07406508 0.5826545
differences for 3 & 13-14 Model depend on age group differences
3 Housing
test.aov2 = aov(Probability ~ Housing, data=probs.pub3)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Housing, data = probs.pub3)
$Housing
diff lwr upr p adj
STD-ENR -0.03519517 -0.1401665 0.06977617 0.4941248
13-14 Housing
test.aov2 = aov(Probability ~ Housing, data=probs.pub13)
TukeyHSD(test.aov2)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = Probability ~ Housing, data = probs.pub13)
$Housing
diff lwr upr p adj
STD-ENR -0.01304957 -0.2609753 0.2348762 0.9089618
Percentage change comparison
pct <- function(x) (x/lag(x)-1)*100
target = c("13-14_WT_STD","13-14_WT_ENR","13-14_dTg_STD","13-14_dTg_ENR","3_WT_STD","3_WT_ENR","3_dTg_STD","3_dTg_ENR","3_APPswe_STD","3_APPswe_ENR","3_PS1dE9_STD","3_PS1dE9_ENR")
percentage= Results.paper %>%
group_by(All) %>%
summarise(across(.cols = 25:50,mean, na.rm=TRUE)) %>%
slice(order(factor(All,levels=target))) %>%
mutate_each(funs(pct), path.length:time.in.zone.pool)
datatable(percentage, rownames = FALSE, filter="top", options = list(pageLength = 21, scrolly="600px") )