Skip to contents

Single call estimation

Usage

diseq_basic(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

# S4 method for formula
diseq_basic(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

diseq_deterministic_adjustment(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

# S4 method for formula
diseq_deterministic_adjustment(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

diseq_directional(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

# S4 method for formula
diseq_directional(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

diseq_stochastic_adjustment(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

# S4 method for formula
diseq_stochastic_adjustment(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

equilibrium_model(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

# S4 method for formula
equilibrium_model(
  specification,
  data,
  correlated_shocks = TRUE,
  verbose = 0,
  estimation_options = list()
)

Arguments

specification

The model's formula.

data

The data to be used with the model.

correlated_shocks

Should the model's system entail correlated shocks? By default the argument is set to TRUE.

verbose

The verbosity with which operations on the model print messages. By default the value is set to 0, which prints only errors.

estimation_options

A list with options to be used in the estimation call. See estimate for the available options.

Value

The fitted model.

Details

The functions of this section combine model initialization and estimation into a single call. They also provide a less verbose interface to the functionality of the package. The functions expect a formula following the specification described in formula, a dataset, and optionally further initialization and estimation options (see model initialization and model estimation respectively).

Estimation options are expected to be given in the argument estimation_options in a form of a list. The list names should correspond to variables of the estimate function. As a result, optimization options, which are customized using the control argument of estimate can be passed as an element of estimation_options.

Each of these functions parses the given formula, initializes the model specified by the function's name, fits the model to the given data using the estimation options and returns fitted model.

Functions

  • diseq_basic: Basic disequilibrium model.

  • diseq_deterministic_adjustment: Disequilibrium model with deterministic price adjustments.

  • diseq_directional: Directional disequilibrium model.

  • diseq_stochastic_adjustment: Disequilibrium model with stochastic price adjustments.

  • equilibrium_model: Equilibrium model

Examples

# \donttest{
# An example of estimating the equilibrium model
eq <- 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(control = list(maxit = 5000))
)

# An example of estimating the deterministic adjustment model
da <- diseq_deterministic_adjustment(
  HS | RM | ID | TREND ~ RM + TREND + W + CSHS + L1RM + L2RM + MONTH |
    RM + TREND + W + L1RM + MA6DSF + MA3DHF + MONTH,
  fair_houses(),
  verbose = 2,
  estimation_options = list(control = list(maxit = 5000))
)
#> Info: This is Deterministic Adjustment model.
#> Warning: Dropping 14 rows due to missing values.
#> Info: Dropping 1 row to generate 'LAGGED_RM'.
#> Info: Sample separated with 18 rows in excess supply and 111 rows in
#>   excess demand states.

# An example of estimating the directional model
dr <- diseq_directional(
  HS | RM | ID | TREND ~ TREND + W + CSHS + L1RM + L2RM |
    RM + TREND + W + MA6DSF + MA3DHF + MONTH,
  fair_houses(), estimation_options = list(
    method = "Nelder-Mead", control = list(maxit = 5000)
  )
)

# An example of estimating the basic model
start <- coef(eq)
start <- start[names(start) != "RHO"]
bs <- diseq_basic(
  HS | RM | ID | TREND ~ RM + TREND + W + CSHS + L1RM + L2RM + MONTH |
    RM + TREND + W + L1RM + MA6DSF + MA3DHF + MONTH,
  fair_houses(), verbose = 2, correlated_shocks = FALSE,
  estimation_options = list(
    start = start,
    control = list(maxit = 5000)
  )
)
#> Info: This is Basic model.
#> Warning: Dropping 14 rows due to missing values.

# An example of estimating the stochastic adjustment model
sa <- diseq_stochastic_adjustment(
  HS | RM | ID | TREND ~ RM + TREND + W + CSHS + MONTH |
    RM + TREND + W + L1RM + L2RM + MA6DSF + MA3DHF + MONTH |
    TREND + L2RM + L3RM,
  fair_houses() |> dplyr::mutate(L3RM = dplyr::lag(RM, 3)),
  correlated_shocks = FALSE,
  estimation_options = list(
    control = list(maxit = 5000), standard_errors = c("W")
  )
)
# }