# [R] svymean in multistage desing

Diego Cuellar dicuell at gmail.com
Wed May 25 22:32:13 CEST 2016

```Thanks for your attention. I have been using  your R library, survey, I
made an example for two stage sampling  SI – SI, an estimate the total and
the mean,  (the point estimation y de SE)

and also, I remaking the estimation.

For the total, point estimation and estimation of the variance, we have
exactly the same number. But for the mean, the estimated sample variance I
found different number.

I have been using  the formula   8.6.6 of Särdall,  -Model Assisted Survey
Sampling-.  That for the  case of  Simple Random sample without replacement
is equal, to the Taylor approximation for two stage sample, Example 5.6.3
of Särdall,  -Model Assisted Survey Sampling-

svymean or svratio are using.

I copy the code.

"id UPS str_UPS USS str_USS hou85 ue91 lab91
clu_1 clu_2 uno

3  1 1 1a 1 9230  1623  13727 62 95  1

4  1 1 2a 1 4896  760   5919  62 95  1

5  1 1 3a 1 4264  767   5823  62 95  1

6  1 1 4a 1 3119  568   4011  62 95  1

7  1 1 5a 2 1946  331   2543  62 95  1

8  1 1 6a 2 1463  187   1448  62 95  1

9  1 1 7a 2 675   129   927   62 95  1

1  2 1 1b 1 26881 4123  33786 62 22  1

2  2 1 2b 1 26881 4123  33786 62 22  1

10 2 1 3b 1 18494 823   18649 62 22  1

11 2 1 4b 2 18196 1543  21004 62 22  1

12 2 1 5b 2 26814 2735  18796 62 22  1

13 2 1 6b 2 26510 2638  920   62 22  1

14 3 2 1c 1 25694 1792  15625 62 256 1

15 3 2 2c 1 14676 494   26122 62 256 1

16 3 2 3c 1 5742  520   4007  62 256 1

17 3 2 4c 1 26024 3827       16850 62 256 1

18 3 2 5c 2 9534  1458        273   62 256 1

19 3 2 6c 2 18236 204         25497 62 256 1

20 3 2 7c 2 22311 1743  13217 62 256 1

21 4 2 1d 1 1689  1797  13383 62 15  1

22 4 2 2d 1 12632 2136  5206  62 15  1

23 4 2 3d 1 11685 534   13461 62 15  1

24 4 2 4d 1 14404 2851  3202  62 15  1

25 4 2 5d 2 3072  223   12818 62 15  1

26 4 2 6d 2 24476 989   414   62 15  1

27 4 2 7d 2 1562  476   20837 62 15  1" ,

View(mydata)

Dis_mues_2_stage<-svydesign(id=~UPS+USS, fpc=~clu_1+clu_2, data=mydata)

svytotal(~ue91, Dis_mues_2_stage)

svymean(~ue91, design=Dis_mues_2_stage)

svyratio(~ue91, ~uno, design=Dis_mues_2_stage,separate=FALSE, na.rm=FALSE)

[[alternative HTML version deleted]]

```