- dat
a data.table
containing household ids (optionally), base
weights (optionally), household and/or personal level variables (numerical
or categorical) that should be fitted.
- hid
name of the column containing the household-ids within dat
or
NULL if such a variable does not exist.
- conP
list or (partly) named list defining the constraints on person
level. The list elements are contingency tables in array representation
with dimnames corresponding to the names of the relevant calibration
variables in dat
. If a numerical variable is to be calibrated, the
respective list element has to be named with the name of that numerical
variable. Otherwise the list element shoud NOT be named.
- conH
list or (partly) named list defining the constraints on
household level. The list elements are contingency tables in array
representation with dimnames corresponding to the names of the relevant
calibration variables in dat
. If a numerical variable is to be
calibrated, the respective list element has to be named with the name of
that numerical variable. Otherwise the list element shoud NOT be named.
- epsP
numeric value or list (of numeric values and/or arrays)
specifying the convergence limit(s) for conP
. The list can contain
numeric values and/or arrays which must appear in the same order as the
corresponding constraints in conP
. Also, an array must have the same
dimensions and dimnames as the corresponding constraint in conP
.
- epsH
numeric value or list (of numeric values and/or arrays)
specifying the convergence limit(s) for conH
. The list can contain
numeric values and/or arrays which must appear in the same order as the
corresponding constraints in conH
. Also, an array must have the same
dimensions and dimnames as the corresponding constraint in conH
.
- verbose
if TRUE, some progress information will be printed.
- w
name if the column containing the base weights within dat
or NULL
if such a variable does not exist. In the latter case, every observation
in dat
is assigned a starting weight of 1.
- bound
numeric value specifying the multiplier for determining the
weight trimming boundary if the change of the base weights should be
restricted, i.e. if the weights should stay between 1/bound
*w
and bound
*w
.
- maxIter
numeric value specifying the maximum number of iterations
that should be performed.
- meanHH
if TRUE, every person in a household is assigned the mean of
the person weights corresponding to the household. If "geometric"
, the
geometric mean is used rather than the arithmetic mean.
- allPthenH
if TRUE, all the person level calibration steps are
performed before the houshold level calibration steps (and meanHH
, if
specified). If FALSE, the houshold level calibration steps (and meanHH
,
if specified) are performed after everey person level calibration step.
This can lead to better convergence properties in certain cases but also
means that the total number of calibration steps is increased.
- returnNA
if TRUE, the calibrated weight will be set to NA in case of
no convergence.
- looseH
if FALSE, the actual constraints conH
are used for
calibrating all the hh weights. If TRUE, only the weights for which the
lower and upper thresholds defined by conH
and epsH
are exceeded are
calibrated. They are however not calibrated against the actual constraints
conH
but against these lower and upper thresholds, i.e.
conH
-conH
*epsH
and conH
+conH
*epsH
.
- numericalWeighting
See numericalWeighting
- check_hh_vars
If TRUE
check for non-unique values inside of a
household for variables in household constraints
- conversion_messages
show a message, if inputs need to be reformatted.
This can be useful for speed optimizations if ipf is called several times
with similar inputs (for example bootstrapping)
- nameCalibWeight
character defining the name of the variable for the
newly generated calibrated weight.
- minMaxTrim
numeric vector of length2, first element a minimum value
for weights to be trimmed to, second element a maximum value for weights to
be trimmed to.