On Oct 12, 12:52 pm, Shai <
shain...@gmail.com> wrote:
> Hi!
>
> Maybe this is for beginners but I still cant get that right... How do
> I use the geom_smooth to draw the dashed 95% confidence intervals
> above and below my trend line? I got to the point where I make the
> gray fill disappear, now I only have to add the two dashed borders!
>
> xvalues <- 0:10
> yvalues <- c(1,3,2,4,5.5,6,2,9,7,8.2,9)
> d <- data.frame(xvalues,yvalues)
> p <- ggplot(d, aes(x=xvalues,y=yvalues))
> p+geom_point()+geom_smooth(method="lm",fill="NA")
geom_smooth does not have a line around it, so there isn't any way to
make it show up. geom_ribbon, on the other hand, does.
p+geom_point()+geom_smooth(method="lm",fill="NA")+
stat_smooth(method="lm",fill=NA,colour="black",linetype=2,geom="ribbon")
You can adjust the color and linetype as you like.
> The borders ARE the confidence intervals right?
>
> Thanks,
> Shai
--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University