While estimating from the survey data involving clustering and using survey package of r, is it possible to estimate at the cluster level? For eg; for following survey design:
data(api)
dclus1 <- svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
This is an example which is reproduced from the survey package. Here, dnum is district and fpc is number of school in the district. In this case, can we creat a subset at district level? For example, to estimate total enrollment in for district with code 637:
sub1=subset(dclus1, dnum==637)
svytotal(~enroll, sub1)
I got the following output:
total SE
enroll 205824 203774
I do not know whether it is correct method or not. Any help would be greatly appreciated.
Yes, you can use
subset. From the documentation (see `?subset.survey.design):You can also use
to calculate your statistics for all clusters.