flatten_ml_fit_problem: Return a flattened representation of a multi-level fitting problem instance
Description
This function transforms a multi-level fitting problem to a representation
more suitable for applying the algorithms: A matrix with one row per controlled
attribute and one column per household, a weight vector with one weight
per household, and a control vector.
Which model matrix building strategy to use? See details.
verbose
If TRUE, print diagnostic output.
x
An object
...
Further parameters passed to the algorithm
Value
An object of classes flat_ml_fit_problem,
essentially a named list.
Details
The standard way to build a model matrix (model_matrix = "combined")
is to include intercepts and avoid repeating redundant attributes.
A simpler model matrix specification, available via model_matrix = "separate",
is suggested by Ye et al. (2009) and required for the ml_fit_ipu() implementation:
Here, simply one column per target value is used, which
results in a larger model matrix if more than one control is given.