任何人都可以告诉我为什么gls函数有时不给出给定dataset的正确截距和斜率?这是一个可重复的例子:
require(nlme)
s=read.csv("exampleglsabline.csv")
m1=gls(log(y)~log(x2)+log(x1),method="REML",data = s)
summary(m1)
x=s$x1
y=residuals(gls(log(y)~log(x2),method="REML",data = s))
plot(x,y,xlab="x1",ylab=expression("y"),
type = 'p',bg=adjustcolor("seashell", alpha=0.8), col = 'black',cex=2, pch=21,cex.lab=1,
xlim=c(min(0),max(x)),
ylim=c(min(y),max(y)))
abline(a=7.251864,b=0.882575)