I have produced a graph of a significant interaction /model prediction from a three-way Linear mixed model, and I am now trying to incorporate the raw data points on top of this graph. I can create the graph of the model estimates using this code (graph attached):
mod.2 <-lm(logRTs ~
bilec_total_input2*Away_Towards*Diagnosis,
data = trimmedRT)
summary(mod.2)
fit <- lm(logRTs ~ bilec_total_input2*Away_Towards*Diagnosis,
data = trimmedRT)
graph <- plot_model(fit, type = "pred",
terms = c("bilec_total_input2",
"Away_Towards",
"Diagnosis"
)
)
plot_model(fit, type = "int")
and I can produce a plot of the raw data using:
rawdatagraph <- ggplot(trimmedRT,
aes(bilec_total_input2, logRTs,
colour = Away_Towards)
)
+ geom_point()
Graph + facet_grid(. ~ Diagnosis)
But I cannot combine the data. I have tried this:
rawdatagraph + ggplot(trimmedRT,
aes(bilec_total_input2, logRTs, colour = Away_Towards)
)
+ geom_point()
Graph + facet_grid(. ~ Diagnosis)
I have also tried:
graph + geom_point(data = trimmedRT,
aes(x = logRTs, y = bilec_total_input2,
colour= Away_Towards))
I keep getting this message: Error in FUN(X[[i]], ...) : object 'group_col' not found.