[R] stratified sampling from known population datafile
Steven Gorlé
steven.gorle at telenet.be
Wed Jan 3 22:29:05 CET 2007
Dear R-wizards,
I have a population from which I want to draw a stratified sample by region.
In Venables and Ripley "Modern Applied statistics with S" I found some
great procedures for Simple Random Sampling (with and without replacement)
and for Systematic sampling and it works!
For stratified sampling I referred to the manual of the survey package.Are
there any other papers available on this subject?
Is the output correct? And how can I draw a random (stratified by region)
sample from my (population) datafile bmi?
dstrat<-svydesign(id=~1,strata=~REGIONCH, data=bmi)
Warning in svydesign(id = ~1, strata = ~REGIONCH, data = bmi) :
No weights or probabilities supplied, assuming equal probability
> summary(dstrat)
Stratified Independent Sampling design (with replacement)
svydesign(id = ~1, strata = ~REGIONCH, data = bmi)
Probabilities:
Min. 1st Qu. Median Mean 3rd Qu. Max.
1 1 1 1 1 1
Stratum Sizes:
Brussels Flanders Walloonia
obs 2571 2987 3006
design.PSU 2571 2987 3006
actual.PSU 2571 2987 3006
Data variables:
[1] "ID" "WFIN" "HH" "REGION" "EDU3" "FA3"
[7] "TA2" "AGE7" "SEX" "VOEG" "BMI" "LNBMI"
[13] "LNVOEG" "FLA" "BRU" "WAL" "AGEGR1" "AGEGR2"
[19] "AGEGR3" "AGEGR4" "AGEGR5" "AGEGR6" "AGEGR7" "EDUPRIM"
[25] "EDUSEC" "EDUHIGH" "INCLOW" "INCMED" "INCHIG" "REGIONCH"
[31] "PROVINCE" "SGP" "GHQ12" "GHQBIN"
> svymean(~BMI, dstrat)
mean SE
BMI NA NA
Thanks in advance!!
Kind regards,
Steven Gorle
More information about the R-help
mailing list