| market_fit-class {markets} | R Documentation |
Market model fit
Description
This is the estimation output class for all market models of the package. It couples
a market model object with estimation results. It provides a common user interface
for accessing estimation results, irrespective of the underlying market model used.
The estimation results are intended to be accessed by passing market_fit
objects to methods such as plot, summary, and
logLik.
Details
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.
Slots
modelThe underlying market model object.
fitA list holding estimation outputs.
See Also
Examples
# estimate an equilibrium model using the houses dataset
fit <- equilibrium_model(
HS | RM | ID | TREND ~
RM + TREND + W + CSHS + L1RM + L2RM + MONTH |
RM + TREND + W + L1RM + MA6DSF + MA3DHF + MONTH,
fair_houses(),
estimation_options = list(method = "2SLS")
)
# access an method of the underlying model
aggregate_demand(fit)
# summary of results
summary(fit)