Delta.clus.Rd
Two small, partially overlapping datasets, built to mimick non-independent PSU samples selected with a one- or multi-stage, stratified, cluster sampling design (but identifiers of SSUs etc. are not reported). Allow to run R code contained in the ‘Examples’ section of ReGenesees function svyDelta
.
data(Delta.clus)
Two data frames, sclus1
and sclus2
, with 6 PSUs each (and 20 and 22 final units, respectively), and the following 5 variables.
For both samples sclus1
and sclus2
:
id
Identifier of sample PSUs, numeric
strata
Stratification variable, a factor
with 2
levels: A
, and B
w
Sampling weights of final units, numeric
y
A numeric
variable
x
A numeric
variable, correlated with y
The two samples, sclus1
and sclus2
, have 3 PSUs in common, resulting in an overlap rate of 3 / 6 = 0.5 at PSU-level. One could think of them as, e.g., two consecutive waves of a rotating panel with a 50% overlap at PSU-level.
Common PSUs are unambigously identified by variable id
.
The stratification is static: (1) sclus1
and sclus2
use the same strata (i.e. levels A
, and B
), and (2) no common PSUs changed stratum from sclus1
to sclus2
.
The ‘Examples’ section of svyDelta
will illustrate the effect of dynamic stratification by injecting new strata and stratum-changer units in the samples.
svyDelta
for calculating estimates and sampling errors of Measures of Change from two not necessarily independent samples, and Delta.el
for 2 artificial overlapping samples of elementary units.
#> id strata w y x #> 1 1 A 18.55982 0.5 0.9299534 #> 2 1 A 21.06586 1.0 2.0829387 #> 3 1 A 21.93166 1.5 3.0842540 #> 4 2 A 19.98340 2.0 0.8722675 #> 5 2 A 18.51504 2.5 3.3248515 #> 6 3 A 20.28786 3.0 -0.3339274 #> 7 3 A 19.47544 3.5 3.8162962 #> 8 3 A 20.08048 4.0 2.2946235 #> 9 3 A 19.35298 4.5 3.5662329 #> 10 4 B 21.64282 5.0 4.5246152 #> 11 4 B 30.33911 5.5 3.3212096 #> 12 4 B 29.99442 6.0 3.8279945 #> 13 4 B 31.15830 6.5 3.9486667 #> 14 5 B 30.75910 7.0 5.1722682 #> 15 5 B 29.87766 7.5 4.3871676 #> 16 5 B 29.97200 8.0 6.2267104 #> 17 5 B 29.66927 8.5 4.4201194 #> 18 5 B 30.54008 9.0 5.7321373 #> 19 6 B 30.21610 9.5 3.6582305 #> 20 6 B 30.05322 10.0 5.6449544sclus2#> id strata w y x #> 1 7 A 18.07945 2.512918 2.078354 #> 2 7 A 19.16909 3.308235 2.686179 #> 3 7 A 19.98976 5.003790 3.743181 #> 4 7 A 19.30035 2.977190 2.923050 #> 5 8 A 20.28916 4.510136 3.046503 #> 6 8 A 20.57337 3.165896 3.431041 #> 7 8 A 20.46191 3.504128 3.298700 #> 8 3 A 20.28786 4.540171 4.835238 #> 9 3 A 19.47544 4.985899 2.876468 #> 10 3 A 20.08048 6.370713 3.967471 #> 11 3 A 19.35298 6.681330 4.072293 #> 12 4 B 21.64282 7.067339 4.694993 #> 13 4 B 30.33911 6.551161 2.886048 #> 14 4 B 29.99442 8.740280 5.930593 #> 15 4 B 31.15830 8.118962 5.003309 #> 16 11 B 29.54043 8.900935 4.997548 #> 17 11 B 31.38035 9.446146 6.679908 #> 18 11 B 31.18770 9.596294 7.131485 #> 19 11 B 29.42232 9.444555 5.482839 #> 20 11 B 29.59098 10.408366 6.806784 #> 21 6 B 30.21610 12.512506 7.079508 #> 22 6 B 30.05322 11.124746 7.090510# Have a look at the overlap subsample of 3 PSUs (36 final units): sc <- merge(sclus1, sclus2, by = "id", suffixes = c("1", "2")) sc#> id strata1 w1 y1 x1 strata2 w2 y2 x2 #> 1 3 A 19.47544 3.5 3.8162962 A 19.47544 4.985899 2.876468 #> 2 3 A 19.47544 3.5 3.8162962 A 20.08048 6.370713 3.967471 #> 3 3 A 19.47544 3.5 3.8162962 A 19.35298 6.681330 4.072293 #> 4 3 A 19.47544 3.5 3.8162962 A 20.28786 4.540171 4.835238 #> 5 3 A 20.08048 4.0 2.2946235 A 19.47544 4.985899 2.876468 #> 6 3 A 20.08048 4.0 2.2946235 A 20.08048 6.370713 3.967471 #> 7 3 A 20.08048 4.0 2.2946235 A 19.35298 6.681330 4.072293 #> 8 3 A 20.08048 4.0 2.2946235 A 20.28786 4.540171 4.835238 #> 9 3 A 19.35298 4.5 3.5662329 A 19.47544 4.985899 2.876468 #> 10 3 A 19.35298 4.5 3.5662329 A 20.08048 6.370713 3.967471 #> 11 3 A 19.35298 4.5 3.5662329 A 19.35298 6.681330 4.072293 #> 12 3 A 19.35298 4.5 3.5662329 A 20.28786 4.540171 4.835238 #> 13 3 A 20.28786 3.0 -0.3339274 A 19.47544 4.985899 2.876468 #> 14 3 A 20.28786 3.0 -0.3339274 A 20.08048 6.370713 3.967471 #> 15 3 A 20.28786 3.0 -0.3339274 A 19.35298 6.681330 4.072293 #> 16 3 A 20.28786 3.0 -0.3339274 A 20.28786 4.540171 4.835238 #> 17 4 B 30.33911 5.5 3.3212096 B 30.33911 6.551161 2.886048 #> 18 4 B 30.33911 5.5 3.3212096 B 29.99442 8.740280 5.930593 #> 19 4 B 30.33911 5.5 3.3212096 B 31.15830 8.118962 5.003309 #> 20 4 B 30.33911 5.5 3.3212096 B 21.64282 7.067339 4.694993 #> 21 4 B 29.99442 6.0 3.8279945 B 30.33911 6.551161 2.886048 #> 22 4 B 29.99442 6.0 3.8279945 B 29.99442 8.740280 5.930593 #> 23 4 B 29.99442 6.0 3.8279945 B 31.15830 8.118962 5.003309 #> 24 4 B 29.99442 6.0 3.8279945 B 21.64282 7.067339 4.694993 #> 25 4 B 31.15830 6.5 3.9486667 B 30.33911 6.551161 2.886048 #> 26 4 B 31.15830 6.5 3.9486667 B 29.99442 8.740280 5.930593 #> 27 4 B 31.15830 6.5 3.9486667 B 31.15830 8.118962 5.003309 #> 28 4 B 31.15830 6.5 3.9486667 B 21.64282 7.067339 4.694993 #> 29 4 B 21.64282 5.0 4.5246152 B 30.33911 6.551161 2.886048 #> 30 4 B 21.64282 5.0 4.5246152 B 29.99442 8.740280 5.930593 #> 31 4 B 21.64282 5.0 4.5246152 B 31.15830 8.118962 5.003309 #> 32 4 B 21.64282 5.0 4.5246152 B 21.64282 7.067339 4.694993 #> 33 6 B 30.21610 9.5 3.6582305 B 30.21610 12.512506 7.079508 #> 34 6 B 30.21610 9.5 3.6582305 B 30.05322 11.124746 7.090510 #> 35 6 B 30.05322 10.0 5.6449544 B 30.21610 12.512506 7.079508 #> 36 6 B 30.05322 10.0 5.6449544 B 30.05322 11.124746 7.090510# Have a look at the full rotation structure (50% PSUs overlap in each stratum): s <- merge(sclus1, sclus2, by = "id", all = TRUE, suffixes = c("1", "2")) s <- s[order(s$strata1, s$strata2), ] s#> id strata1 w1 y1 x1 strata2 w2 y2 x2 #> 6 3 A 19.47544 3.5 3.8162962 A 19.47544 4.985899 2.876468 #> 7 3 A 19.47544 3.5 3.8162962 A 20.08048 6.370713 3.967471 #> 8 3 A 19.47544 3.5 3.8162962 A 19.35298 6.681330 4.072293 #> 9 3 A 19.47544 3.5 3.8162962 A 20.28786 4.540171 4.835238 #> 10 3 A 20.08048 4.0 2.2946235 A 19.47544 4.985899 2.876468 #> 11 3 A 20.08048 4.0 2.2946235 A 20.08048 6.370713 3.967471 #> 12 3 A 20.08048 4.0 2.2946235 A 19.35298 6.681330 4.072293 #> 13 3 A 20.08048 4.0 2.2946235 A 20.28786 4.540171 4.835238 #> 14 3 A 19.35298 4.5 3.5662329 A 19.47544 4.985899 2.876468 #> 15 3 A 19.35298 4.5 3.5662329 A 20.08048 6.370713 3.967471 #> 16 3 A 19.35298 4.5 3.5662329 A 19.35298 6.681330 4.072293 #> 17 3 A 19.35298 4.5 3.5662329 A 20.28786 4.540171 4.835238 #> 18 3 A 20.28786 3.0 -0.3339274 A 19.47544 4.985899 2.876468 #> 19 3 A 20.28786 3.0 -0.3339274 A 20.08048 6.370713 3.967471 #> 20 3 A 20.28786 3.0 -0.3339274 A 19.35298 6.681330 4.072293 #> 21 3 A 20.28786 3.0 -0.3339274 A 20.28786 4.540171 4.835238 #> 1 1 A 18.55982 0.5 0.9299534 <NA> NA NA NA #> 2 1 A 21.06586 1.0 2.0829387 <NA> NA NA NA #> 3 1 A 21.93166 1.5 3.0842540 <NA> NA NA NA #> 4 2 A 19.98340 2.0 0.8722675 <NA> NA NA NA #> 5 2 A 18.51504 2.5 3.3248515 <NA> NA NA NA #> 22 4 B 30.33911 5.5 3.3212096 B 30.33911 6.551161 2.886048 #> 23 4 B 30.33911 5.5 3.3212096 B 29.99442 8.740280 5.930593 #> 24 4 B 30.33911 5.5 3.3212096 B 31.15830 8.118962 5.003309 #> 25 4 B 30.33911 5.5 3.3212096 B 21.64282 7.067339 4.694993 #> 26 4 B 29.99442 6.0 3.8279945 B 30.33911 6.551161 2.886048 #> 27 4 B 29.99442 6.0 3.8279945 B 29.99442 8.740280 5.930593 #> 28 4 B 29.99442 6.0 3.8279945 B 31.15830 8.118962 5.003309 #> 29 4 B 29.99442 6.0 3.8279945 B 21.64282 7.067339 4.694993 #> 30 4 B 31.15830 6.5 3.9486667 B 30.33911 6.551161 2.886048 #> 31 4 B 31.15830 6.5 3.9486667 B 29.99442 8.740280 5.930593 #> 32 4 B 31.15830 6.5 3.9486667 B 31.15830 8.118962 5.003309 #> 33 4 B 31.15830 6.5 3.9486667 B 21.64282 7.067339 4.694993 #> 34 4 B 21.64282 5.0 4.5246152 B 30.33911 6.551161 2.886048 #> 35 4 B 21.64282 5.0 4.5246152 B 29.99442 8.740280 5.930593 #> 36 4 B 21.64282 5.0 4.5246152 B 31.15830 8.118962 5.003309 #> 37 4 B 21.64282 5.0 4.5246152 B 21.64282 7.067339 4.694993 #> 43 6 B 30.21610 9.5 3.6582305 B 30.21610 12.512506 7.079508 #> 44 6 B 30.21610 9.5 3.6582305 B 30.05322 11.124746 7.090510 #> 45 6 B 30.05322 10.0 5.6449544 B 30.21610 12.512506 7.079508 #> 46 6 B 30.05322 10.0 5.6449544 B 30.05322 11.124746 7.090510 #> 38 5 B 30.75910 7.0 5.1722682 <NA> NA NA NA #> 39 5 B 29.87766 7.5 4.3871676 <NA> NA NA NA #> 40 5 B 29.97200 8.0 6.2267104 <NA> NA NA NA #> 41 5 B 29.66927 8.5 4.4201194 <NA> NA NA NA #> 42 5 B 30.54008 9.0 5.7321373 <NA> NA NA NA #> 47 7 <NA> NA NA NA A 18.07945 2.512918 2.078354 #> 48 7 <NA> NA NA NA A 19.16909 3.308235 2.686179 #> 49 7 <NA> NA NA NA A 19.98976 5.003790 3.743181 #> 50 7 <NA> NA NA NA A 19.30035 2.977190 2.923050 #> 51 8 <NA> NA NA NA A 20.28916 4.510136 3.046503 #> 52 8 <NA> NA NA NA A 20.57337 3.165896 3.431041 #> 53 8 <NA> NA NA NA A 20.46191 3.504128 3.298700 #> 54 11 <NA> NA NA NA B 29.54043 8.900935 4.997548 #> 55 11 <NA> NA NA NA B 31.38035 9.446146 6.679908 #> 56 11 <NA> NA NA NA B 31.18770 9.596294 7.131485 #> 57 11 <NA> NA NA NA B 29.42232 9.444555 5.482839 #> 58 11 <NA> NA NA NA B 29.59098 10.408366 6.806784#> strata2 #> strata1 A B <NA> #> A 16 0 5 #> B 0 20 5 #> <NA> 7 5 0