[R] Case weighting

Thomas Lumley tlumley at uw.edu
Fri Feb 24 07:03:17 CET 2012


>On Fri, Feb 24, 2012 at 9:40 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Feb 23, 2012, at 3:27 PM, Hed Bar-Nissan wrote:
>
>> It's really weighting - it's just that my simplified example was too
>> simplified
>> Here is my real weight vector:
>> > sc$W_FSCHWT
>>  [1]  14.8579  61.9528   3.0420   2.9929   5.1239  14.7507   2.7535
>> 2.2693   3.6658   8.6179   2.5926   2.5390   1.7354   2.9767   9.0477
>> 2.6589   3.4040   3.0519
>> ....
>
>
> You should always convey the necessary complexity of the problem.
>
>>
>>
>> And still it should somehow set the case weight.
>> I could multiply all by 10000 and use maybe your method but it would
>> create such a bloated dataframe
>>
>> working with numeric only i could probably create weighted means
>>
>> But something simple as WEIGHTED BY would be nice.
>
>
> The survey package by Thomas Lumley provides for a wide variety of weighted
> analyses.

Yes.  It doesn't do everything that SPSS WEIGHTED BY will do, but it
does a lot.  SPSS is more general partly because it cheats -- it
doesn't always compute the right standard errors if the weights are
sampling weights   [SPSS now has some proper survey analysis commands,
which do get the right standard errors, but are more limited]

  - thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland



More information about the R-help mailing list