Jesse001 - 2 months ago 20

R Question

I'm plotting a logarithmic regression's line of best fit as well as the confidence intervals around that line. The code I'm using works well enough, except I'd rather that the confidence intervals both be gray (rather than the default red and green). Unfortunately, I'm not seeing a way to isolate them when specifying color changes.

Ideally I'd like it to end with the regression line itself to have: lty=1, col="black", and the confidence intervals to have: lty=2, col="gray".

**How can I isolate the confidence interval lines to make them gray and change their type independent of the regression line itself?**

my code is of the sort:

`R6cl<-lm(log(R6$y)~R6$x)`

pR6cl<-predict(R6cl,interval="confidence")

plot(R6$x,log(R6$y), type= "p")

matlines(x=R6$x,y=log(R6$y),lwd=2,lty=1, col="black")

which produces:

Answer