p.WR {TeachingSampling} | R Documentation |
Generalization of every with replacement sampling design
Description
Computes the selection probability (sampling design) of each with replacement sample
Usage
p.WR(N, m, pk)
Arguments
N |
Population size |
m |
Sample size |
pk |
A vector containing selection probabilities for each unit in the population |
Details
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!}\prod_{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.
Value
The function returns a vector of selection probabilities for every with-replacement sample.
Author(s)
Hugo Andres Gutierrez Rojas hagutierrezro@gmail.com
References
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.
Examples
############
## 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)