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.

estimate(object, ...)

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

# S4 method for 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

# \donttest{
# 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)
#> Deterministic Adjustment Model for Markets in Disequilibrium
#>   Demand RHS        : D_RM + D_TREND + D_W + D_CSHS + D_L1RM + D_L2RM + D_MONTH
#>   Supply RHS        : S_RM + S_TREND + S_W + S_L1RM + S_MA6DSF + S_MA3DHF + S_MONTH
#>   Short Side Rule   : HS = min(D_HS, S_HS)
#>   Separation Rule   : RM_DIFF analogous to (D_HS - S_HS)
#>   Shocks            : Independent
#>   Nobs              : 129
#>   Sample Separation : Demand Obs = 18, Supply Obs = 111
#>   Quantity Var      : HS
#>   Price Var         : RM
#>   Key Var(s)        : ID, TREND
#>   Time Var          : TREND
#> 
#> Maximum likelihood estimation
#>   Method              : BFGS
#>   Max Iterations      : 1000000
#>   Convergence Status  : success
#>   Starting Values     :
#>       D_RM    D_CONST    D_TREND        D_W     D_CSHS     D_L1RM     D_L2RM 
#>  7.528e-02  7.462e+01  2.432e+00  2.395e+00 -1.977e-02  1.512e-01 -3.291e-01 
#>  D_MONTH02  D_MONTH03  D_MONTH04  D_MONTH05  D_MONTH06  D_MONTH07  D_MONTH08 
#>  2.918e+00  3.110e+01  6.173e+01  6.452e+01  5.819e+01  4.851e+01  4.744e+01 
#>  D_MONTH09  D_MONTH10  D_MONTH11  D_MONTH12       S_RM    S_CONST    S_TREND 
#>  4.219e+01  4.566e+01  2.885e+01  8.548e+00  1.465e-01 -5.076e+01 -1.243e-01 
#>        S_W     S_L1RM   S_MA6DSF   S_MA3DHF  S_MONTH02  S_MONTH03  S_MONTH04 
#>  2.669e+00 -8.889e-02  4.754e-02  4.554e-02  3.371e+00  3.254e+01  6.598e+01 
#>  S_MONTH05  S_MONTH06  S_MONTH07  S_MONTH08  S_MONTH09  S_MONTH10  S_MONTH11 
#>  6.660e+01  5.605e+01  4.175e+01  4.719e+01  4.172e+01  4.892e+01  3.026e+01 
#>  S_MONTH12    RM_DIFF D_VARIANCE S_VARIANCE 
#>  1.094e+01 -4.684e-16  1.960e+02  1.035e+02 
#> 
#> Coefficients
#>              Estimate Std. Error    z value     Pr(z)
#> D_RM         -6.39287   0.716320     -8.925 4.473e-19
#> D_CONST     -20.16533   0.050930   -395.941 0.000e+00
#> D_TREND      -3.09531   0.192880    -16.048 5.915e-58
#> D_W           2.77910   1.575357      1.764 7.771e-02
#> D_CSHS        0.02879   0.002195     13.116 2.664e-39
#> D_L1RM        8.92812   1.063078      8.398 4.527e-17
#> D_L2RM       -2.48884   0.649900     -3.830 1.284e-04
#> D_MONTH02    17.94359   0.023684    757.619 0.000e+00
#> D_MONTH03    28.55311   0.026652   1071.351 0.000e+00
#> D_MONTH04    78.00304   0.020975   3718.826 0.000e+00
#> D_MONTH05    84.17025   0.011472   7336.988 0.000e+00
#> D_MONTH06    82.50862   0.006690  12332.551 0.000e+00
#> D_MONTH07    88.22174   0.028303   3117.083 0.000e+00
#> D_MONTH08    52.40941   0.057247    915.496 0.000e+00
#> D_MONTH09    49.40058   0.012242   4035.254 0.000e+00
#> D_MONTH10    67.05086   0.020939   3202.246 0.000e+00
#> D_MONTH11    24.50612   0.017495   1400.718 0.000e+00
#> D_MONTH12    30.86397   0.031006    995.410 0.000e+00
#> S_RM          0.46443   0.212955      2.181 2.919e-02
#> S_CONST     -37.46456   0.014824  -2527.241 0.000e+00
#> S_TREND      -0.14555   0.037968     -3.833 1.264e-04
#> S_W           2.08579   0.557609      3.741 1.836e-04
#> S_L1RM       -0.40511   0.216985     -1.867 6.190e-02
#> S_MA6DSF      0.04694   0.003975     11.807 3.591e-32
#> S_MA3DHF      0.03455   0.006227      5.549 2.879e-08
#> S_MONTH02     3.81911   0.032474    117.604 0.000e+00
#> S_MONTH03    34.38728   0.037536    916.119 0.000e+00
#> S_MONTH04    65.75523   0.040470   1624.775 0.000e+00
#> S_MONTH05    67.60422   0.005683  11896.056 0.000e+00
#> S_MONTH06    57.39162   0.008645   6638.560 0.000e+00
#> S_MONTH07    43.90384   0.078843    556.849 0.000e+00
#> S_MONTH08    49.34402   0.027708   1780.883 0.000e+00
#> S_MONTH09    44.93630   0.038175   1177.100 0.000e+00
#> S_MONTH10    49.43638   0.039061   1265.612 0.000e+00
#> S_MONTH11    32.80683   0.008787   3733.512 0.000e+00
#> S_MONTH12    11.27186   0.075982    148.348 0.000e+00
#> RM_DIFF       1.53371   0.622140      2.465 1.369e-02
#> D_VARIANCE 1295.13137   0.006740 192154.909 0.000e+00
#> S_VARIANCE  107.76447   0.006593  16344.955 0.000e+00
#> 
#> -2 log L: 1724.67
# }