I am fairly new to R and I am working on analyzing some data in ggplot2.
I have one set of data that has hormone values for a type of animal. The animals came from two sites (Control, New). I analyzed the data using an ANCOVA and plotted the predicted regression lines based on the model. What I would really like to do, is plot dotted confidence interval lines around both lines on my graph. I can't seem to find/figure out how to perform this using the ggplot2 package. I moved to the package initially because my sample sizes are unequal. Any help would be appreciated.
Here is the code I have used thus far:
Data <- read.csv("Data.csv")
library(ggplot2) # package for plotting
library(outliers) # package for rntransform
aov.con <- aov(rntransform(Hormone) ~ Length + Status, data=Data) ### ANCOVA
pred <- predict(aov.con)
ggplot(Data, aes(Length, Hormone, color=Status)) +
geom_point() +
geom_line(aes(y=pred)) +
theme_bw() +
theme(panel.border = element_rect(colour = "black", fill=NA, size=1),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour =
"black"))