[R] Creating a weighted sample - Help

LouiseS louise at sinfield.uk.net
Wed Mar 2 17:50:06 CET 2011


Hi

I'm new to R and most things I want to do I can do but I'm stuck on how to
weight a sample.  I have had a look through the post but I can't find
anything that addresses my specific problem.  I am wanting to scale up a
sample which has been taken based on a single variable (perf) which has 4
attributes H,I, J and K.  The make up of the sample is shown below:-

Perf	         Factored Count (A)	Raw Count (B)	Factor (A/B)
H	               5,945	                       2,924	        2.033174
I 	               1,305	                       2,436	        0.535714
J 	               2,000	                       2,092	        0.956023
K	                750	                       1,225	        0.612245


I then want to produce all further analysis based on this factored sample. 
I can produce a weighted sample in SAS using the weight function which I
have shown below

wt=0;
if perf='H' then wt=2.033174;
if perf='I ' then wt=0.535714;
if perf='J ' then wt=0.956023;
if perf='K ' then wt=0.612245;

proc freq data=DD.new;
tables resdstat;
weight wt;
run;

Does anyone know how to reproduce this in R?

Thanks very much

--
View this message in context: http://r.789695.n4.nabble.com/Creating-a-weighted-sample-Help-tp3331842p3331842.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list