Predicting with ggplot

Hi there,

Created a predictive plot with ggplot2, as follows:

pred.int <- predict(model, interval = "prediction")
mydata <- cbind(df_linelist_yearweeks, pred.int)
# 2. Regression line + confidence intervals
library("ggplot2")
p <- ggplot(mydata, aes(weeknumber, cm_cases)) +
  geom_point() +
  stat_smooth(method = lm)
# 3. Add prediction intervals
#p + geom_line(aes(y = lwr), color = "red", linetype = "dashed")+
#    geom_line(aes(y = upr), color = "red", linetype = "dashed")
#4. Print just the plot. 
p

The prediction intervals are not working, unfortunately, and I'd like to see the plot when cm_cases=1000.

Hi @graceahey,
I think you need to specify the x values in the line plotting:

p + geom_line(aes(y = lwr, x=weeknumber)