[R] DIfference between weights options in lm GLm and gls.

2006-03-16 Thread Goeland
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,

[R] DIfference between weights options in lm GLm and gls.

2006-03-16 Thread Goeland
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

Re: [R] DIfference between weights options in lm GLm and gls.

2006-03-23 Thread Spencer Graves
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:

Re: [R] DIfference between weights options in lm GLm and gls.

2006-03-23 Thread Sundar Dorai-Raj
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

Re: [R] DIfference between weights options in lm GLm and gls.

2006-03-23 Thread Spencer Graves
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

Re: [R] DIfference between weights options in lm GLm and gls.

2006-03-23 Thread Peter Dalgaard
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