[R] Weight in Function RM

Thomas Lumley tlumley at uw.edu
Wed Sep 7 11:05:40 CEST 2011


On Wed, Sep 7, 2011 at 4:28 PM, Suphajak Ngamlak
<Suphajak at phatrasecurities.com> wrote:
> Dear all,
>
> I am trying to do weighted regression using lm function in R. However, I have a question why the results from
>
>
> 1)      lm(formula = Y~aX, weight = w)
>
> 2)      lm(formula = wY~waX)
>
> are different. Aren't they supposed to have the exactly same result?

No. lm(formula = wY~waX) is the same as lm(formula = Y~aX, weight = w^2)

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland



More information about the R-help mailing list