[R] Question on WLS (gls vs lm)
Stats Wolf
stats.wolf at gmail.com
Thu Jun 24 09:16:57 CEST 2010
Hi all,
I understand that gls() uses generalized least squares, but I thought
that maybe optimum weights from gls might be used as weights in lm (as
shown below), but apparently this is not the case. See:
library(nlme)
f1 <- gls(Petal.Width ~ Species / Petal.Length, data = iris, weights
= varIdent(form = ~ 1 | Species))
aa <- attributes(summary(f1)$modelStruct$varStruct)$weights
f2 <- lm(Petal.Width ~ Species / Petal.Length, data = iris, weights = aa)
summary(f1)$tTable; summary(f2)
So, the two models with the very same weights do differ (in terms of
standard errors). Could you please explain why? Are these different
types of weights?
Many thanks in advance,
Stats Wolf
More information about the R-help
mailing list