[R] Question on WLS (gls vs lm)
Joris Meys
jorismeys at gmail.com
Thu Jun 24 12:49:05 CEST 2010
Isn't that exactly what you would expect when using a _generalized_
least squares compared to a normal least squares? GLS is not the same
as WLS.
http://www.aiaccess.net/English/Glossaries/GlosMod/e_gm_least_squares_generalized.htm
Cheers
Joris
On Thu, Jun 24, 2010 at 9:16 AM, Stats Wolf <stats.wolf at gmail.com> wrote:
> 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
>
> ______________________________________________
> 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.
>
--
Joris Meys
Statistical consultant
Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control
tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
More information about the R-help
mailing list