[R] using weights in lm()

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Dec 7 15:36:55 CET 1999


On Tue, 7 Dec 1999, Wolfgang Koller wrote:

> Hello!
> 
> When I know the vector of the variance of the disturbances (i.e. the 
> structure of heteroskedasticity), say Var(u_{i})=v_{i},
> what is the weights I should use as argument to lm(): 
> 
> M <- lm(y~x,weigths=1/v)
> 
>   or 
> 
> M <- lm(y~x,weights=1/(v^0.5))   ???
> 
> In the help pages I did not find a clear answer to this question, so 
> please could someone help me!

?lm says:

 weights: an optional vector of weights to be used in the
          fitting process.

That means it does weighted least-squares with weights w, minimizing
sum(w*e*e) where e = y - X %*% b. I assume that you want weights = 1/v,
as that gives the MLE, but what you use is a modelling decision
(and I am working in fMRI where people deliberately do not use the MLE
weighting).

If it had said it did weighted least squares with weights w, would
that have been clear enough?

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list