1
votes

I am attempting to plot the model below with a regression line, and I can generate a plot but none of the abline commands I have tried (also below) seem to work. R will appear to be happy and not output any error messages with the first abline command I try, but no line will appear on the plot. I've tried adding the abline function into the plot code itself too but this hasn't worked either. Any help would be appreciated.

model2<-gls(transformedlongevity~transformedproportion, data=independencedata, 
            correlation=corPagel(1,trimtree))
summary(model2)
plot(model2, xlab= "Transformed Value of Proportion of Life Spent Under Parental Care (Years)", 
     ylab="Transformed Value of Maximum Life Span (Years)", 
     main= "Time Spent Under Parental Care Relative 
     to Longevity of Passerine Species")


abline(gls(transformedproportion~transformedlongevity, independencedata), untf=T)
abline(a=0, b=coef(model2)) 
abline(coef(model2)) 
1
Can you provide the output of dput(independencedata) after editing the question?Bappa Das

1 Answers

0
votes

Please include the package used in your post. So if your gls comes from nlme then the plot you are seeing is for residuals, not predicted values. Using an example set from nlme:

library(nlme)
fm1 <- gls(follicles ~ Time, Ovary,
            correlation = corAR1(form = ~ 1 | Mare))
plot(fm1)

enter image description here

So a fitted line doesn't make sense here. You most likely want to do:

plot(Ovary$Time,Ovary$follicles)
abline(fm1,col="blue")