I've used nlme to generate a linear model from my data.
library(nlme)
my_model <- lme(metric ~ group * time, random = "~1 | tech_rep", na.action = "na.omit", data = my_data)
Here's the head of my_data:
my_data <- structure(list(metric = c(0.229408093077531, 0.557876142808238,
-0.103660803953543, -0.100357167905223, -0.174724156150028, -0.304488308271723
), group = structure(c(2L, 2L, 2L, 2L, 2L, 2L), levels = c("unedited_baseline",
"unedited_vehicle", "unedited_MSH3aso_0.022uM", "unedited_MSH3aso_0.26uM",
"unedited_MSH3aso_3uM", "unedited_SCRaso_3uM"), class = "factor"),
time = c(3, 3, 3, 3, 3, 3), tech_rep = c(1L, 2L, 3L, 1L,
2L, 3L)), row.names = c(NA, -6L), class = c("tbl_df", "tbl",
"data.frame"))
I now want to plot using ggplot, with a linear regression line rendered with geom_smooth() or stat_smooth(), so I get the 95% confidence interval. However, want the line to generated using my_model above. How can I do that?
R, read around, no solution yet