'Second order probabilities in stratified sample with probability proportional to size

I have a dataset that looks like this data looks something like this.

set.seed(135)
library(data.table)
# create dataset
dt <- data.table(units=c("Yves", "Ken", "Erik", "Sharon", "Leslie","Mark", "Emily"),
                 size= c(52, 60, 75, 100, 50,30,80),
                 strata= c("A", "A", "A","A", "B", "B", "B"))
print(dt)
    units size strata
1:   Yves   52      A
2:    Ken   60      A
3:   Erik   75      A
4: Sharon  100      A
5: Leslie   50      B
6:   Mark   30      B
7:  Emily   80      B

I have drawn a stratified sample with probability proportional to size using the TeachingSampling package

library(TeachingSampling)
# I determine the sample size in each stratum 
mh <- c(2,2)
# Draw a stratified PPS sample with replacement of size n=4
res <- S.STpiPS(dt$strata, dt$size, mh)
# The selected sample
sam <- res[,1]
U[sam]
 "Erik"   "Sharon" "Leslie" "Emily" 

Now let us assume that "Erik" refuses to take part in the survey and I need to sample a replacement. How can I make a the second call selection using second-order probabilities?.

thanks a lot for your help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source