On Thu, Jun 24, 2010 at 9:20 AM, Viechtbauer Wolfgang (STAT)
<wolfgang.viechtba...@stat.unimaas.nl> wrote:
> The weights in 'aa' are the inverse standard deviations. But you want to use 
> the inverse variances as the weights:
>
> aa <- (attributes(summary(f1)$modelStruct$varStruct)$weights)^2
>
> And then the results are essentially identical.
>

We might now ask how we might have found Wolfgang's answer via
calculation.  Lets redo the gls calculation of variance from scratch
by iterated re-weighted least squares (just one iteration here) and
compare that to the gls aa calculated by the original poster:

# estimate beta
fm <- lm(Petal.Width ~ Species / Petal.Length, iris)

# estimate variance
v <- fitted(lm(resid(fm)^2 ~ Species, iris))
v <- v/v[1]

# compare to aa from original poster
lm(log(aa) ~ log(v))

The last line gives:

(Intercept)       log(v)
-4.212e-07   -5.000e-01

which suggsts:   aa = 1/sqrt(variance)

______________________________________________
R-help@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.

Reply via email to