1## from Takahiro Tsuchiya 2library(survey) 3kigyo<-read.table(tmp<-textConnection(" obs uriage srs.w pps.w 41 1 15 100 20 52 2 143 100 200 63 3 21 100 11 74 4 51 100 25 85 5 337 100 550 96 6 50 100 30 107 7 274 100 250 118 8 145 100 100 129 9 15 100 10 1310 10 86 100 55 14",open="r"),header=TRUE) 15close(tmp) 16des.srs <- svydesign(ids=~1, weights=~srs.w, data=kigyo) 17(res.srs <- svymean(~uriage, des.srs, deff=TRUE)) 18(SE(res.srs)^2) / ((1-10/1000) * coef(svyvar(~uriage, des.srs)) / 10) 19 20(tres.srs <- svytotal(~uriage, des.srs, deff=TRUE)) 21(SE(tres.srs)^2) / (1000^2 * (1-10/1000) * coef(svyvar(~uriage, des.srs)) / 10) 22 23 24des.pps <- svydesign(ids=~1, weights=~pps.w, data=kigyo) 25(res.pps <- svymean(~uriage, des.pps, deff='replace')) 26(SE(res.pps)^2) / (coef(svyvar(~uriage, des.pps)) / 10) 27(tres.pps <- svytotal(~uriage, des.pps, deff='replace')) 28(N.hat <- sum(weights(des.pps))) 29(SE(tres.pps)^2) / (N.hat^2 * coef(svyvar(~uriage, des.pps)) / 10) 30