distributeDraws_cpp {sdcMicro} | R Documentation |
Distribute number of swaps
Description
Distribute number of swaps across lowest hierarchy level according to a predefined swaprate
. The swaprate is applied such that a single swap counts as swapping 2 households.
Number of swaps are randomly rounded up or down, if needed, such that the total number of swaps is in coherence with the swaprate.
NOTE: This is an internal function used for testing the C++-function distributeDraws
which is used inside the C++-function recordSwap()
.
Usage
distributeDraws_cpp(data, hierarchy, hid, swaprate, seed = 123456L)
Arguments
data |
micro data containing the hierarchy levels and household ID |
hierarchy |
column indices of variables in |
hid |
column index in |
swaprate |
double between 0 and 1 defining the proportion of households which should be swapped, see details for more explanations |
seed |
integer setting the sampling seed |