Randomly select donor records given a probability weight vector. This sampling procedure is implemented differently than randSample_cpp
to speed up performance of C++-function recordSwap()
.
NOTE: This is an internal function used for testing the C++-function sampleDonor
which is used inside the C++-function recordSwap()
.
sampleDonor_cpp(
data,
similar_cpp,
hid,
IDswap,
IDswap_pool_vec,
prob,
seed = 123456L
)
micro data containing the hierarchy levels and household ID
List where each entry corresponds to column indices of variables in data
which should be considered when swapping households.
column index in data
which refers to the household identifier.
vector containing records for which a donor needs to be sampled
set from which `IDswap` was drawn
a vector of probability weights for obtaining the elements of the vector being sampled.
integer setting the sampling seed