【问题标题】:Abline for gls won't plot用于 gls 的 Abline 不会绘图
【发布时间】:2020-04-16 13:35:02
【问题描述】:

我试图用回归线绘制下面的模型,我可以生成一个图,但我尝试过的 abline 命令(也在下面)似乎都不起作用。 R 看起来很高兴,并且我尝试的第一个 abline 命令不会输出任何错误消息,但绘图上不会出现任何线条。我也尝试将 abline 函数添加到绘图代码本身,但这也没有奏效。任何帮助将不胜感激。

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)) 

【问题讨论】:

  • 能否提供编辑问题后dput(independencedata)的输出?

标签: r


【解决方案1】:

请附上您帖子中使用的包裹。因此,如果您的gls 来自nlme,那么您看到的图是残差,而不是预测值。使用来自 nlme 的示例集:

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

所以拟合线在这里没有意义。您很可能想要这样做:

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

【讨论】:

    猜你喜欢
    • 2011-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-03
    • 2017-06-12
    • 1970-01-01
    • 1970-01-01
    • 2016-07-31
    相关资源
    最近更新 更多