[R] Question on WLS (gls vs lm)

From: Stats Wolf <stats.wolf_at_gmail.com>
Date: Thu, 24 Jun 2010 09:16:57 +0200

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:

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

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 24 Jun 2010 - 07:20:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jun 2010 - 11:00:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive