Learn R Programming

sdcMicro (version 5.7.8)

setRisk_cpp: Calculate Risk

Description

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

Usage

setRisk_cpp(data, hierarchy, risk_variables, hid)

Arguments

data

micro data set containing only numeric values.

hierarchy

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

risk_variables

column indices of variables in data which will be considered for estimating the risk.

hid

column index in data which refers to the household identifier.