[R] sample weights in ols

Thomas Lumley tlumley at uw.edu
Tue May 10 22:11:33 CEST 2011


On Tue, May 10, 2011 at 2:50 PM, jour4life <jour4life at gmail.com> wrote:
> Hello all,
>
> I am wondering if there is a way to specify sampling weights for an ols
> model using sample weights.
>
> For instance, right now, my code is:
>
> fit.ex<-lm(y~x1+x2+x3+...xk,data=dataset,weights=weightvariable.)
> summary(fit.ex)
>
> But, there is almost no difference in the coefficients nor standard errors.
> I am skeptical that I am using the option correctly since many posts state
> that the "weights" option is for weighted least squares. Or is this the same
> thing?

You want svyglm() in the survey package.

    -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland



More information about the R-help mailing list