market_simulation: Market model simulation

market_simulationR Documentation

Market model simulation

Description

Market data and model simulation functionality based on the data generating process induced by the market model specifications.

simulate_data

Returns a data tibble with simulated data from a generating process that matches the passed model string. By default, the simulated observations of the controls are drawn from a normal distribution.

simulate_model

Simulates a data tibble based on the generating process of the passed model and uses it to initialize a model object. Data are simulated using the simulate_data function.

Usage

simulate_data(
  model_type_string,
  nobs = NA_integer_,
  tobs = NA_integer_,
  alpha_d = NA_real_,
  beta_d0 = NA_real_,
  beta_d = NA_real_,
  eta_d = NA_real_,
  alpha_s = NA_real_,
  beta_s0 = NA_real_,
  beta_s = NA_real_,
  eta_s = NA_real_,
  gamma = NA_real_,
  beta_p0 = NA_real_,
  beta_p = NA_real_,
  sigma_d = 1,
  sigma_s = 1,
  sigma_p = 1,
  rho_ds = 0,
  rho_dp = 0,
  rho_sp = 0,
  seed = NA_integer_,
  price_generator = function(n) stats::rnorm(n = n),
  control_generator = function(n) stats::rnorm(n = n),
  verbose = 0
)

## S4 method for signature 'ANY'
simulate_data(
  model_type_string,
  nobs = NA_integer_,
  tobs = NA_integer_,
  alpha_d = NA_real_,
  beta_d0 = NA_real_,
  beta_d = NA_real_,
  eta_d = NA_real_,
  alpha_s = NA_real_,
  beta_s0 = NA_real_,
  beta_s = NA_real_,
  eta_s = NA_real_,
  gamma = NA_real_,
  beta_p0 = NA_real_,
  beta_p = NA_real_,
  sigma_d = 1,
  sigma_s = 1,
  sigma_p = 1,
  rho_ds = 0,
  rho_dp = 0,
  rho_sp = 0,
  seed = NA_integer_,
  price_generator = function(n) stats::rnorm(n = n),
  control_generator = function(n) stats::rnorm(n = n),
  verbose = 0
)

simulate_model(
  model_type_string,
  simulation_parameters,
  seed = NA,
  verbose = 0,
  ...
)

## S4 method for signature 'ANY'
simulate_model(
  model_type_string,
  simulation_parameters,
  seed = NA,
  verbose = 0,
  ...
)

Arguments

model_type_string

Model type. It should be among equilibrium_model, diseq_basic, diseq_directional, diseq_deterministic_adjustment, and diseq_stochastic_adjustment.

nobs

Number of simulated entities.

tobs

Number of simulated dates.

alpha_d

Price coefficient of demand.

beta_d0

Constant coefficient of demand.

beta_d

Coefficients of exclusive demand controls.

eta_d

Demand coefficients of common controls.

alpha_s

Price coefficient of supply.

beta_s0

Constant coefficient of supply.

beta_s

Coefficients of exclusive supply controls.

eta_s

Supply coefficients of common controls.

gamma

Price equation's stability factor.

beta_p0

Price equation's constant coefficient.

beta_p

Price equation's control coefficients.

sigma_d

Demand shock's standard deviation.

sigma_s

Supply shock's standard deviation.

sigma_p

Price equation shock's standard deviation.

rho_ds

Demand and supply shocks' correlation coefficient.

rho_dp

Demand and price shocks' correlation coefficient.

rho_sp

Supply and price shocks' correlation coefficient.

seed

Pseudo random number generator seed.

price_generator

Pseudo random number generator callback for prices. The default generator is N(2.5, 0.25).

control_generator

Pseudo random number generator callback for non-price controls. The default generator is N(2.5, 0.25).

verbose

Verbosity level.

simulation_parameters

List of parameters used in model simulation. See the simulate_data function for details.

...

Additional parameters to be passed to the model's constructor.

Value

simulate_data: The simulated data.

simulate_model: The simulated model.

Functions

  • simulate_data: Simulate model data.

  • simulate_model: Simulate model.


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