Calculate risk for records to be swapped and donor records. Risks are defined by 1/counts, where counts is the number of records with the same values for specified risk_variables
in the each geographic hierarchy.
This risk will be used as sampling probability for both sampling set and donor set.
NOTE: This is an internal function used for testing the C++-function setRisk
which is used inside the C++-function recordSwap()
.
setRisk_cpp(data, hierarchy, risk_variables, hid)
micro data set containing only numeric values.
column indices of variables in data
which refere to the geographic hierarchy in the micro data set. For instance county > municipality > district.
column indices of variables in data
which will be considered for estimating the risk.
column index in data
which refers to the household identifier.