0

Anybody could please tell me why gls function sometimes does not give the correct intercept and slope for a given dataset? Here is a reproducible example:

  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)

enter image description here

Agus camacho
  • 868
  • 2
  • 9
  • 24

0 Answers0