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().

distributeDraws_cpp(data, hierarchy, hid, swaprate, seed = 123456L)



micro data containing the hierarchy levels and household ID


column indices of variables in data which refers to the geographic hierarchy in the micro data set. For instance county > municipality > district.


column index in data which refers to the household identifier.


double between 0 and 1 defining the proportion of households which should be swapped, see details for more explanations


integer setting the sampling seed