The market_fit
class composes the market_models
class with the estimation results obtained by optim
,
lm
or GSL
. All the public functionality of the
underlying market model is also directly accessible from the output class.
Furthermore, the class is responsible for harmonizing the heterogeneous
outputs resulting from different estimation methods of market models. For
example, a 2SLS
estimation of the
equilibrium_model
returns a list of linear regression
models (the first stage, demand, and supply models), while the maximum
likelihood estimation of diseq_basic
returns an
optim
list. In both cases, the market_fit
stores the estimation output in the member fit
of type list
and produces additional harmonized list elements. Methods of the class
examine the type of the fit
and direct execution accordingly to different
branches to produce a unified experience for the caller.