Skip to content
Prev 58142 / 398498 Next

Weighted regresion using lm

On Thu, 28 Oct 2004, Yu Shao wrote:

            
Yes you can, as you have the sources and the documentation.  (R is Open 
Source.)  You could also do a simple experiment like that below.

Weighted regression is not defined to use normalized weights, and this is
not done in R.  Note, though, that the fit and the coefficients are the
same whether you normalize or not.

y <- rnorm(100)
x <- runif(100)
w <- 1:100
w1 <- w/sum(w)
(fm <- lm(y ~x, weights=w))
(fm1 <- lm(y ~x, weights=w1))
summary(fm)
summary(fm1)

show that only the residual se and the residuals are affected.