estimate: Model estimation.

estimateR Documentation

Model estimation.

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

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

  • estimate,market_model-method: Full information maximum likelihood estimation.

  • estimate,equilibrium_model-method: Equilibrium model estimation.

Examples


# initialize the model using the houses dataset
model <- new(
  "diseq_deterministic_adjustment", # model type
  subject = ID, time = TREND, quantity = HS, price = RM,
  demand = RM + TREND + W + CSHS + L1RM + L2RM + MONTH,
  supply = RM + TREND + W + L1RM + MA6DSF + MA3DHF + MONTH,
  fair_houses(), # data
  correlated_shocks = FALSE # let shocks be independent
)

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

# estimate the model by specifying the optimization details passed to the optimizer.
fit <- estimate(model, control = list(maxit = 1e+6))

# summarize results
summary(fit)


diseq documentation built on June 2, 2022, 1:10 a.m.