market_simulation {markets} | R 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 frame 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 frame 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,
correlated_shocks = TRUE
)
## S4 method for signature 'ANY'
simulate_model(
model_type_string,
simulation_parameters,
seed = NA,
verbose = 0,
correlated_shocks = TRUE
)
Arguments
model_type_string |
Model type. It should be among |
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 |
control_generator |
Pseudo random number generator callback for non-price
controls. The default generator is |
verbose |
Verbosity level. |
simulation_parameters |
List of parameters used in model simulation. See the
|
correlated_shocks |
Should the model be estimated using correlated shocks? |
Value
simulate_data
The simulated data.
simulate_model
The simulated model
.
Functions
-
simulate_data()
: Simulate model data. -
simulate_model()
: Simulate model.
Examples
model <- simulate_model(
"diseq_stochastic_adjustment", list(
# observed entities, observed time points
nobs = 500, tobs = 3,
# demand coefficients
alpha_d = -0.1, beta_d0 = 9.8, beta_d = c(0.3, -0.2), eta_d = c(0.6, -0.1),
# supply coefficients
alpha_s = 0.1, beta_s0 = 6.1, beta_s = c(0.9), eta_s = c(-0.5, 0.2),
# price equation coefficients
gamma = 1.2, beta_p0 = 3.1, beta_p = c(0.8)
),
seed = 31
)