简体   繁体   English

用于 gls 的 Abline 不会 plot

[英]Abline for gls won't plot

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.我正在尝试使用回归线 plot 下面的 model ,我可以生成 plot 但我尝试过的所有 abline 命令似乎都不起作用(也在下面)。 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. R 似乎很高兴,而不是 output 我尝试的第一个 abline 命令出现任何错误消息,但 plot 上不会出现任何行。 I've tried adding the abline function into the plot code itself too but this hasn't worked either.我也尝试将 abline function 添加到 plot 代码本身中,但这也不起作用。 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)) 

Please include the package used in your post.请包括在您的帖子中使用的 package。 So if your gls comes from nlme then the plot you are seeing is for residuals, not predicted values.因此,如果您的gls来自nlme ,那么您看到的 plot 是残差,而不是预测值。 Using an example set from nlme:使用来自 nlme 的示例集:

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

在此处输入图像描述

So a fitted line doesn't make sense here.所以拟合线在这里没有意义。 You most likely want to do:您最有可能想要这样做:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM