tests/svyby_se.R

library(survey)
data(api)
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)

a<-svyby(~enroll,~stype,design=dstrat,svytotal,vartype=c("ci","se"))
b<-svyby(~enroll,~stype,design=dstrat,svytotal,vartype=c("se","ci"))


stopifnot(all.equal(SE(a),SE(b)))

Try the survey package in your browser

Any scripts or data that you put into this service are public.

survey documentation built on July 19, 2021, 9:06 a.m.