dimanche 18 octobre 2020

sampling using sampling package in R: multistage sampling vs separate sampling calls

In package sampling, I was wondering how to use mstage() instead of using two cluster() calls below? That is, I want my final mstage() results to be like my cl2 in my R code below.

library(sampling)

p <- read.csv('https://raw.githubusercontent.com/rnorouzian/d/master/a.csv')

cl1 <- cluster(p, "dname", 40, "srswor")

xx <- getdata(p, cl1)

cl2 <- cluster(xx, "sname", 126, "srswor")

xx2 <- getdata(xx, cl2)

length(table(xx$dname)) # 126 as expected

## Try above together but fails:
m <- mstage(p, stage = list("cluster", "cluster"), varnames = list("dname", "sname"), 
            size = list(40, 126),method = list("srswor","srswor"))



Aucun commentaire:

Enregistrer un commentaire