estimate: Model estimation.

Description Usage Arguments Value Functions Examples

Description

All models are estimated using full information maximum likelihood. The equilibrium_model can also be estimated using two-stage least squares. The maximum likelihood estimation is based on mle2. If no starting values are provided, the function uses linear regression estimates as initializing values. The default optimization method is BFGS. For other alternatives see mle2. The implementation of the two-stage least square estimation of the equilibrium_model is based on systemfit.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
estimate(object, ...)

## S4 method for signature 'market_model'
estimate(
  object,
  gradient = "calculated",
  hessian = "calculated",
  standard_errors = "homoscedastic",
  ...
)

## S4 method for signature 'equilibrium_model'
estimate(object, method = "BFGS", ...)

Arguments

object

A model object.

...

Named parameter used in the model's estimation. These are passed further down to the estimation call. For the equilibrium_model model, the parameters are passed to systemfit, if the method is set to 2SLS, or to mle2 for any other method. For the rest of the models, the parameters are passed to mle2.

gradient

One of two potential options: 'numerical' and 'calculated'. By default, all the models are estimated using the analytic expressions of their likelihoods' gradients.

hessian

One of three potential options: 'skip', 'numerical', and 'calculated'. The default is to use the 'calculated' Hessian for the model that expressions are available and the 'numerical' Hessian in other cases. Calculated Hessian expressions are available for the basic and directional models.

standard_errors

One of three potential options: 'homoscedastic', 'heteroscedastic', or a vector with variables names for which standard error clusters are to be created. The default value is 'homoscedastic'. If the option 'heteroscedastic' is passed, the variance-covariance matrix is calculated using heteroscedasticity adjusted (Huber-White) standard errors. If the vector is supplied, the variance-covariance matrix is calculated by grouping the score matrix based on the passed variables.

method

A string specifying the estimation method. When the passed value is among Nelder-Mead, BFGS, CG, L-BFGS-B, SANN, and Brent, the model is estimated using full information maximum likelihood based on mle2 functionality. When 2SLS is supplied, the model is estimated using two-stage least squares based on systemfit. In this case, the function returns a list containing the first and second stage estimates. The default value is BFGS.

Value

The object that holds the estimation result.

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# initialize the model using the houses dataset
model <- new(
  "diseq_deterministic_adjustment", # model type
  c("ID", "TREND"), "TREND", "HS", "RM", # keys, time, quantity, and price variables
  "RM + TREND + W + CSHS + L1RM + L2RM + MONTH", # demand specification
  "RM + TREND + W + L1RM + MA6DSF + MA3DHF + MONTH", # supply specification
  fair_houses(), # data
  correlated_shocks = FALSE # allow shocks to be correlated
)

# estimate the model object (BFGS is used by default)
est <- estimate(model)

# estimate the model by specifying the optimization details passed to the optimizer.
est <- estimate(model, control = list(maxit = 1e+5), method = "BFGS")

# summarize results
bbmle::summary(est)

diseq documentation built on May 12, 2021, 1:06 a.m.