[R] stratified sampling from known population datafile

From: Steven Gorlé <steven.gorle_at_telenet.be>
Date: Wed 03 Jan 2007 - 21:29:05 GMT


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri Jan 05 08:03:37 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 04 Jan 2007 - 21:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.