data(fpc)
fpc
withoutfpc<-svydesign(weights=~weight, ids=~psuid, strata=~stratid, variables=~x, data=fpc, nest=TRUE)
withoutfpc
svymean(~x, withoutfpc)
withfpc<-svydesign(weights=~weight, ids=~psuid, strata=~stratid,
fpc=~Nh, variables=~x, data=fpc, nest=TRUE)
withfpc
svymean(~x, withfpc)
## Other equivalent forms
withfpc<-svydesign(prob=~I(1/weight), ids=~psuid, strata=~stratid,
fpc=~Nh, variables=~x, data=fpc, nest=TRUE)
svymean(~x, withfpc)
withfpc<-svydesign(weights=~weight, ids=~psuid, strata=~stratid,
fpc=~I(nh/Nh), variables=~x, data=fpc, nest=TRUE)
svymean(~x, withfpc)
withfpc<-svydesign(weights=~weight, ids=~interaction(stratid,psuid), strata=~stratid,
fpc=~I(nh/Nh), variables=~x, data=fpc)
svymean(~x, withfpc)
fpctbl<-data.frame(strata=c(1,2), sizes=c(15,12))
withfpc<-svydesign(weights=~weight, ids=~psuid, strata=~stratid, fpc=fpctbl, variables=~x, data=fpc, nest=TRUE)
svymean(~x, withfpc)
Run the code above in your browser using DataLab