The function provides sample techniques with sampling probabilities which are proportional to the size of a quantity z.

pps.sampling(z, n, id = 1:N, method = 'sampford', return.PI = FALSE)

## Arguments

z vector of quantities which determine the sampling probabilities in the population positive integer for sample size an optional vector with identification values for population elements. Default is 'id = 1:N', where 'N' is length of 'z'. the sampling method to be used. Options are 'sampford', 'tille', 'midzuno' or 'madow'. logical. If TRUE the pairwise inclusion probabilities for all individuals in the population are returned.

## Details

The different methods vary in their run time. Therefore, method='sampford' is stopped if N > 200 or if n/N < 0.3. method='tille' is stopped if N > 500. In case of large populations use method='midzuno' or method='madow'.

## Value

The function pps.sampling returns a value, which is a list consisting of the components

call

is a list of call components: z vector of quantity data, n sample size, id identification values, and method sampling method

sample

resulted sample

pik

inclusion probabilities

PI

sample second order inclusion probabilities

PI.full

full second order inclusion probabilities

## References

Kauermann, Goeran/Kuechenhoff, Helmut (2010): Stichproben. Methoden und praktische Umsetzung mit R. Springer.

## Author

Juliane Manitz

htestimate

## Examples

## 1) simple suppositious example
data <- data.frame(id = 1:7, z = c(1.8, 2 ,3.2 ,2.9 ,1.5 ,2.0 ,2.2))
# Usage of pps.sampling for Sampford method
set.seed(178209)
pps.sample_sampford <- pps.sampling(z=data$z, n=2, method='sampford', return.PI=FALSE) pps.sample_sampford #> #> pps.sampling object: Sample with probabilities proportional to size #> Method of Sampford: #> #> PPS sample: #> [1] 3 7 #> #> Sample probabilities: #> [,1] [,2] #> [1,] 0.41025641 0.07281474 #> [2,] 0.07281474 0.28205128# sampling elements id.sample <- pps.sample_sampford$sample
id.sample
#> [1] 3 7# other methods
set.seed(178209)
pps.sample_tille <- pps.sampling(z=data$z, n=2, method='tille') pps.sample_tille #> #> pps.sampling object: Sample with probabilities proportional to size #> Method of Tille: #> #> PPS sample: #> [1] 1 3 #> #> Sample probabilities: #> [,1] [,2] #> [1,] 0.23076923 0.05955335 #> [2,] 0.05955335 0.41025641set.seed(178209) pps.sample_midzuno <- pps.sampling(z=data$z, n=2, method='midzuno')
pps.sample_midzuno
#>
#> pps.sampling object: Sample with probabilities proportional to size
#> Method of Midzuno:
#>
#> PPS sample:
#> [1] 3 4
#>
#> Sample probabilities:
#>            [,1]       [,2]
#> [1,] 0.41025641 0.08974359
#> [2,] 0.08974359 0.37179487set.seed(178209)
pps.sample_madow <- pps.sampling(z=data$z, n=2, method='madow') #> Warning: Systematic Sample with zeros in 'PI': For calculating estimates use approximate methods.pps.sample_madow #> #> pps.sampling object: Sample with probabilities proportional to size #> Method of Madow: #> #> PPS sample: #> [1] 3 6 #> #> Sample probabilities: #> [,1] [,2] #> [1,] 0.4102564 0.2307692 #> [2,] 0.2307692 0.2564103 ## 2) influenza data(influenza) summary(influenza) #> id district population cases #> Min. : 1001 LK Aachen : 1 Min. : 34719 Min. : 0.00 #> 1st Qu.: 5877 LK Ahrweiler : 1 1st Qu.: 104553 1st Qu.: 9.00 #> Median : 8331 LK Aichach-Friedberg: 1 Median : 145130 Median : 27.00 #> Mean : 8468 LK Alb-Donau-Kreis : 1 Mean : 193910 Mean : 44.58 #> 3rd Qu.: 9778 LK Altenburger Land : 1 3rd Qu.: 244154 3rd Qu.: 59.00 #> Max. :16077 LK Altenkirchen : 1 Max. :1770629 Max. :410.00 #> (Other) :418 set.seed(108506) pps <- pps.sampling(z=influenza$population,n=20,method='midzuno')
pps
#>
#> pps.sampling object: Sample with probabilities proportional to size
#> Method of Midzuno:
#>
#> PPS sample:
#>  [1]  35  83 107 109 130 140 157 210 219 223 257 273 290 294 324 342 361 371 418
#> [20] 423
#>
#> Sample probabilities:
#>              [,1]         [,2]         [,3]         [,4]         [,5]
#>  [1,] 0.090052479 0.0053250174 0.0059535012 0.0047392541 0.0034975812
#>  [2,] 0.005325017 0.0622266431 0.0040841690 0.0032027173 0.0023764993
#>  [3,] 0.005953501 0.0040841690 0.0702093391 0.0036435201 0.0026981161
#>  [4,] 0.004739254 0.0032027173 0.0036435201 0.0549863651 0.0020847939
#>  [5,] 0.003497581 0.0023764993 0.0026981161 0.0020847939 0.0401586824
#>  [6,] 0.003732237 0.0025338499 0.0028776442 0.0022220297 0.0016004173
#>  [7,] 0.006483352 0.0045523488 0.0050892276 0.0040569473 0.0029997593
#>  [8,] 0.008401858 0.0060389695 0.0067597276 0.0053697111 0.0039575729
#>  [9,] 0.012398528 0.0088061102 0.0098845055 0.0078132411 0.0057404116
#> [10,] 0.005174948 0.0035019448 0.0039719917 0.0030984806 0.0023004465
#> [11,] 0.002864379 0.0019502481 0.0022124945 0.0017123914 0.0012252743
#> [12,] 0.008450507 0.0060727695 0.0067978960 0.0053995583 0.0039793498
#> [13,] 0.009647954 0.0069047173 0.0077373683 0.0061342117 0.0045153648
#> [14,] 0.003036693 0.0020665218 0.0023448451 0.0018140834 0.0012971039
#> [15,] 0.006431964 0.0045069425 0.0050384741 0.0040168511 0.0029705044
#> [16,] 0.004274207 0.0028953870 0.0032909440 0.0025366183 0.0018582626
#> [17,] 0.001019824 0.0006958571 0.0007887969 0.0006115611 0.0004389276
#> [18,] 0.021162722 0.0148352675 0.0166928972 0.0131373023 0.0096249324
#> [19,] 0.001754391 0.0011966398 0.0013566479 0.0010515130 0.0007543015
#> [20,] 0.007120642 0.0051154636 0.0057186561 0.0045542072 0.0033625680
#>               [,6]         [,7]        [,8]        [,9]        [,10]
#>  [1,] 0.0037322373 0.0064833515 0.008401858 0.012398528 0.0051749484
#>  [2,] 0.0025338499 0.0045523488 0.006038970 0.008806110 0.0035019448
#>  [3,] 0.0028776442 0.0050892276 0.006759728 0.009884505 0.0039719917
#>  [4,] 0.0022220297 0.0040569473 0.005369711 0.007813241 0.0030984806
#>  [5,] 0.0016004173 0.0029997593 0.003957573 0.005740412 0.0023004465
#>  [6,] 0.0429213432 0.0032000875 0.004223948 0.006129724 0.0024525529
#>  [7,] 0.0032000875 0.0776962790 0.007376869 0.010839972 0.0044258747
#>  [8,] 0.0042239481 0.0073768695 0.101469709 0.013610984 0.0058670986
#>  [9,] 0.0061297244 0.0108399724 0.013610984 0.145720691 0.0085497394
#> [10,] 0.0024525529 0.0044258747 0.005867099 0.008549739 0.0603389749
#> [11,] 0.0013160329 0.0024584545 0.003239456 0.004693184 0.0018882346
#> [12,] 0.0042472268 0.0074191704 0.009478120 0.013668384 0.0058998664
#> [13,] 0.0048202032 0.0084603611 0.010675567 0.015081223 0.0067064091
#> [14,] 0.0013934264 0.0026058836 0.003434764 0.004977611 0.0020007067
#> [15,] 0.0031688154 0.0055617878 0.007317016 0.010747307 0.0043818549
#> [16,] 0.0019798777 0.0036619353 0.004839951 0.007032667 0.0028018497
#> [17,] 0.0004710923 0.0008759647 0.001152750 0.001667949 0.0006738797
#> [18,] 0.0102821064 0.0183855203 0.023526910 0.031543156 0.0143947850
#> [19,] 0.0008096773 0.0015067189 0.001983242 0.002870225 0.0011588027
#> [20,] 0.0035879141 0.0062419697 0.008119152 0.011989184 0.0049717937
#>              [,11]       [,12]       [,13]        [,14]        [,15]
#>  [1,] 0.0028643788 0.008450507 0.009647954 0.0030366928 0.0064319641
#>  [2,] 0.0019502481 0.006072769 0.006904717 0.0020665218 0.0045069425
#>  [3,] 0.0022124945 0.006797896 0.007737368 0.0023448451 0.0050384741
#>  [4,] 0.0017123914 0.005399558 0.006134212 0.0018140834 0.0040168511
#>  [5,] 0.0012252743 0.003979350 0.004515365 0.0012971039 0.0029705044
#>  [6,] 0.0013160329 0.004247227 0.004820203 0.0013934264 0.0031688154
#>  [7,] 0.0024584545 0.007419170 0.008460361 0.0026058836 0.0055617878
#>  [8,] 0.0032394561 0.009478120 0.010675567 0.0034347640 0.0073170160
#>  [9,] 0.0046931835 0.013668384 0.015081223 0.0049776115 0.0107473066
#> [10,] 0.0018882346 0.005899866 0.006706409 0.0020007067 0.0043818549
#> [11,] 0.0327578552 0.003257213 0.003694280 0.0010480086 0.0024346001
#> [12,] 0.0032572130 0.102010224 0.010724216 0.0034536096 0.0073589162
#> [13,] 0.0036942799 0.010724216 0.115314393 0.0039174705 0.0083902417
#> [14,] 0.0010480086 0.003453610 0.003917471 0.0347627729 0.0025805668
#> [15,] 0.0024346001 0.007358916 0.008390242 0.0025805668 0.0769701592
#> [16,] 0.0015276777 0.004866735 0.005525980 0.0016180460 0.0036259547
#> [17,] 0.0003527623 0.001159043 0.001313939 0.0003761049 0.0008675107
#> [18,] 0.0078606233 0.023638836 0.026393757 0.0083392295 0.0182213615
#> [19,] 0.0006059566 0.001994077 0.002260750 0.0006461439 0.0014921643
#> [20,] 0.0027542889 0.008166424 0.009329958 0.0029198540 0.0061912162
#>              [,16]        [,17]       [,18]        [,19]       [,20]
#>  [1,] 0.0042742071 0.0010198236 0.021162722 0.0017543911 0.007120642
#>  [2,] 0.0028953870 0.0006958571 0.014835268 0.0011966398 0.005115464
#>  [3,] 0.0032909440 0.0007887969 0.016692897 0.0013566479 0.005718656
#>  [4,] 0.0025366183 0.0006115611 0.013137302 0.0010515130 0.004554207
#>  [5,] 0.0018582626 0.0004389276 0.009624932 0.0007543015 0.003362568
#>  [6,] 0.0019798777 0.0004710923 0.010282106 0.0008096773 0.003587914
#>  [7,] 0.0036619353 0.0008759647 0.018385520 0.0015067189 0.006241970
#>  [8,] 0.0048399514 0.0011527504 0.023526910 0.0019832423 0.008119152
#>  [9,] 0.0070326670 0.0016679492 0.031543156 0.0028702253 0.011989184
#> [10,] 0.0028018497 0.0006738797 0.014394785 0.0011588027 0.004971794
#> [11,] 0.0015276777 0.0003527623 0.007860623 0.0006059566 0.002754289
#> [12,] 0.0048667349 0.0011590435 0.023638836 0.0019940766 0.008166424
#> [13,] 0.0055259804 0.0013139393 0.026393757 0.0022607503 0.009329958
#> [14,] 0.0016180460 0.0003761049 0.008339229 0.0006461439 0.002919854
#> [15,] 0.0036259547 0.0008675107 0.018221362 0.0014921643 0.006191216
#> [16,] 0.0493637409 0.0005460989 0.011810244 0.0009388111 0.004108154
#> [17,] 0.0005460989 0.0116140248 0.002790485 0.0002041539 0.000980808
#> [18,] 0.0118102439 0.0027904849 0.242136509 0.0048028196 0.020421365
#> [19,] 0.0009388111 0.0002041539 0.004802820 0.0199937150 0.001687221
#> [20,] 0.0041081542 0.0009808080 0.020421365 0.0016872205 0.086701381sample <- influenza[pps\$sample,]
sample
#>        id            district population cases
#> 35   5554           LK Borken     370196    86
#> 83   8117       LK Goeppingen     255807    67
#> 107  3254       LK Hildesheim     288623    85
#> 109  6434  LK Hochtaunuskreis     226043     8
#> 130  3457             LK Leer     165088     5
#> 140  3355        LK Lueneburg     176445    57
#> 157  5770 LK Minden-Luebbecke     319401    86
#> 210  8119  LK Rems-Murr-Kreis     417131   110
#> 219  5382 LK Rhein-Sieg-Kreis     599042    72
#> 223  9187        LK Rosenheim     248047    67
#> 257  1061        LK Steinburg     134664    22
#> 273  5978             LK Unna     419353    42
#> 290  5170            LK Wesel     474045     8
#> 294 15091       LK Wittenberg     142906    22
#> 324  5314             SK Bonn     316416    11
#> 342 16051           SK Erfurt     202929   188
#> 361  9464              SK Hof      47744    12
#> 371  5315            SK Koeln     995397    35
#> 418  3405    SK Wilhelmshaven      82192    17
#> 423  5124        SK Wuppertal     356420    62