market_aggregation: Market side aggregation.

Description Usage Arguments Details Value Functions See Also Examples

Description

Market side aggregation.

Usage

1
2
3
4
5
6
7
8
9
aggregate_demand(object, parameters)

## S4 method for signature 'market_model'
aggregate_demand(object, parameters)

aggregate_supply(object, parameters)

## S4 method for signature 'market_model'
aggregate_supply(object, parameters)

Arguments

object

A model object.

parameters

A vector of model's 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.

Value

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

Functions

See Also

demanded_quantities, supplied_quantities

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# initialize the basic model using the houses dataset
model <- new(
  "diseq_basic", # model type
  c("ID", "TREND"), "HS", "RM", # keys, 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)

# get estimated aggregate demand
aggregate_demand(model, est@coef)

# 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
est <- estimate(model)

# get estimated aggregate demand
aggregate_demand(model, est@coef)

# get estimated aggregate demand
aggregate_supply(model, est@coef)

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