Market side aggregation.

aggregate_demand(fit, model, parameters)

# S4 method for missing,market_model,ANY
aggregate_demand(model, parameters)

aggregate_supply(fit, model, parameters)

# S4 method for missing,market_model,ANY
aggregate_supply(model, parameters)

# S4 method for market_fit,missing,missing
aggregate_demand(fit)

# S4 method for market_fit,missing,missing
aggregate_supply(fit)

Arguments

fit

A fitted market model object.

model

A model object.

parameters

A vector of model's parameters.

Value

The sum of the estimated demanded or supplied quantities evaluated at the given parameters.

Details

Calculates the sample's aggregate demand or supply at the passed set of parameters. If the model is static, as is for example the case of equilibrium_model, then all observations are aggregated. If the used data have a time dimension and aggregation per date is required, it can be manually performed using the demanded_quantities and supplied_quantities functions. If the model has a dynamic component, such as the diseq_deterministic_adjustment, then demanded and supplied quantities are automatically aggregated for each time point.

Functions

  • aggregate_demand: Demand aggregation.

  • aggregate_supply: Supply aggregation.

See also

demanded_quantities, supplied_quantities

Examples

# \donttest{
fit <- diseq_basic(
  HS | RM | ID | TREND ~
  RM + TREND + W + CSHS + L1RM + L2RM + MONTH |
    RM + TREND + W + L1RM + MA6DSF + MA3DHF + MONTH,
  fair_houses(),
  correlated_shocks = FALSE
)
#> Warning: Using formula(x) is deprecated when x is a character vector of length > 1.
#>   Consider formula(paste(x, collapse = " ")) instead.
#> Warning: Using formula(x) is deprecated when x is a character vector of length > 1.
#>   Consider formula(paste(x, collapse = " ")) instead.

# get estimated aggregate demand
aggregate_demand(fit)
#> # A tibble: 130 × 2
#>    TREND  D_HS
#>    <int> <dbl>
#>  1    15  200.
#>  2    16  237.
#>  3    17  246.
#>  4    18  250.
#>  5    19  253.
#>  6    20  258.
#>  7    21  256.
#>  8    22  272.
#>  9    23  260.
#> 10    24  244.
#> # … with 120 more rows

# simulate the deterministic adjustment model
model <- simulate_model(
  "diseq_deterministic_adjustment", list(
    # observed entities, observed time points
    nobs = 500, tobs = 3,
    # demand coefficients
    alpha_d = -0.6, beta_d0 = 9.8, beta_d = c(0.3, -0.2), eta_d = c(0.6, -0.1),
    # supply coefficients
    alpha_s = 0.2, beta_s0 = 4.1, beta_s = c(0.9), eta_s = c(-0.5, 0.2),
    # price equation coefficients
    gamma = 0.9
  ),
  seed = 1356
)

# estimate the model object
fit <- estimate(model)

# get estimated aggregate demand
aggregate_demand(fit)
#> # A tibble: 2 × 2
#>   date    D_Q
#>   <fct> <dbl>
#> 1 2     3870.
#> 2 3     3679.

# get estimated aggregate demand
aggregate_supply(fit)
#> # A tibble: 2 × 2
#>   date    S_Q
#>   <fct> <dbl>
#> 1 2     3368.
#> 2 3     3423.
# }