Description Usage Arguments Details Value Author(s) References Examples
Computes the selection probability (sampling design) of each with replacement sample
1 | p.WR(N, m, pk)
|
N |
Population size |
m |
Sample size |
pk |
A vector containing selection probabilities for each unit in the population |
Every with replacement sampling design is a particular case of a multinomial distribution.
p(\mathbf{S}=\mathbf{s})=\frac{m!}{n_1!n_2!\cdots n_N!}∏_{i=1}^N p_k^{n_k}
where n_k is the number of times that the k-th unit is selected in a sample.
The function returns a vector of selection probabilities for every with-replacement sample.
Hugo Andres Gutierrez Rojas hagutierrezro@gmail.com
Sarndal, C-E. and Swensson, B. and Wretman, J. (1992), Model Assisted Survey Sampling. Springer.
Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros.
Editorial Universidad Santo Tomas.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ############
## Example 1
############
# With replacement simple random sampling
# Vector U contains the label of a population of size N=5
U <- c("Yves", "Ken", "Erik", "Sharon", "Leslie")
# Vector pk is the sel?ection probability of the units in the finite population
pk <- c(0.2, 0.2, 0.2, 0.2, 0.2)
sum(pk)
N <- length(pk)
m <- 3
# The smapling design
p <- p.WR(N, m, pk)
p
sum(p)
############
## Example 2
############
# With replacement PPS random sampling
# Vector U contains the label of a population of size N=5
U <- c("Yves", "Ken", "Erik", "Sharon", "Leslie")
# Vector x is the auxiliary information and y is the variables of interest
x<-c(32, 34, 46, 89, 35)
y<-c(52, 60, 75, 100, 50)
# Vector pk is the sel?ection probability of the units in the finite population
pk <- x/sum(x)
sum(pk)
N <- length(pk)
m <- 3
# The smapling design
p <- p.WR(N, m, pk)
p
sum(p)
|
Loading required package: dplyr
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Loading required package: magrittr
[1] 1
[1] 0.008 0.024 0.024 0.024 0.024 0.024 0.048 0.048 0.048 0.024 0.048 0.048
[13] 0.024 0.048 0.024 0.008 0.024 0.024 0.024 0.024 0.048 0.048 0.024 0.048
[25] 0.024 0.008 0.024 0.024 0.024 0.048 0.024 0.008 0.024 0.024 0.008
[1] 1
[1] 1
[1] 0.002492952 0.007946285 0.010750856 0.020800569 0.008179999 0.008442927
[7] 0.022845568 0.044201208 0.017382498 0.015454355 0.059801635 0.023517497
[13] 0.057851582 0.045501244 0.008946874 0.002990203 0.012136708 0.023481892
[19] 0.009234452 0.016420252 0.063539237 0.024987340 0.061467306 0.048345072
[25] 0.009506053 0.007405212 0.042982425 0.016903201 0.083161649 0.065408038
[31] 0.012861131 0.053633237 0.063275167 0.024883493 0.003261881
[1] 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.