Collection of scripts for analyses and plots we usually make in the lab.
Table of Contents
# LINEAR MIXED EFFECTS MODELS
# For linear mixed effects models on "Open Field Data" use lmer, and then use anova to find the F and p-values. The creators of lmer are opposed to p-values for lmer does not automatically give it.
Mixopenfield = lmer(value ~ Condition * variable + (1|Mouse),
data=arishopenfield,
REML = FALSE)
anova(Mixopenfield)
# PAIRWISE COMPARISONS USING EMMEANS
emmeans(Mixopenfield, list(pairwise ~ variable*Condition), adjust = "tukey")
#These will give bar graphs with a dot representing each data point overlayed on the bar.
BarOpenField = ggplot(data=arishopenfield, aes(x=Condition, y=value, fill=variable)) +
geom_bar(stat="summary", fun.y="mean", position=position_dodge()) +
labs(#title = "Open Field Data",
# caption = "WRITE A CAPTION",
# tag = "Figure #",
x = "Housing Condition",
y = "Time spent in center of field (seconds)") +
geom_dotplot(aes(fill = variable, color = variable), trim = FALSE,
binaxis='y', stackdir='center', dotsize = 0.8,
position = position_dodge(), show.legend = FALSE ) +
theme_bw() +
scale_fill_manual(name="Stress Exposure",
labels = c("Pre-Stress","Post-Stress"),
values=c('dark grey','light grey')) +
scale_color_manual(values = c("black", "black"))
ggsave("OpenField.tif", plot = BarOpenField, dpi = 300, device = "tiff")