Dear R-List users,
Can anyone explain exactly the difference between Weights options in lm glm
and gls?
I try the following codes, but the results are different.
> lm1
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept)x
0.1183 7.3075
> lm2
Call:
lm(formula = y ~ x,
Dear r-users,
Can anyone explain exactly the difference between Weights options in lm glm
and gls?
I try the following codes, but the results are different.
> lm1
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept)x
0.1183 7.3075
> lm2
Call:
lm(formula = y ~ x, weight
In my tests, "gls" did NOT give the same answers as "lm" and "glm",
and I don't know why; perhaps someone else will enlighten us both. I
got the same answers from "lm" and "glm". Since you report different
results, please supply a replicatable example.
I tried the following:
Hi, Spencer,
For your call to gls you actually want:
fit.gls.w <- gls(y~x, data=DF, weights=varFixed(~1/w))
HTH,
--sundar
Spencer Graves wrote:
> In my tests, "gls" did NOT give the same answers as "lm" and "glm",
> and I don't know why; perhaps someone else will enlighten us both. I
Hi, Sundar:
Thanks, Sundar. That should have been obvious to me. However, I
hadn't used varFixed before, and evidently I thought about it for only 1
ms instead of the required 2. With that change, I get the same answers
for all three.
Best Wishes,
spencer
Sundar
Spencer Graves <[EMAIL PROTECTED]> writes:
> In my tests, "gls" did NOT give the same answers as "lm" and "glm",
> and I don't know why; perhaps someone else will enlighten us both.
The weights argument in gls (&gnls&lme&nlme) specifies the variance,
not the actual weight which is the r