run_sim: Run data simulations and tests together

Description Usage Arguments Details Value

Description

The function allows to simulate data for a truncated dataset with truncation based on the outcome of two decisions and unobservables. The function allows to specify three tests to detect complementarity between the decisions.

Usage

1
2
3
4
run_sim(obs = 200, rate = 0.5, sd = 1, b1 = c(0, 0, 0, 0), b2 = c(1,
  1, 1), d = c(1, 1, 1), g1 = c(0, 0, 0), g2 = c(0, 0, 0), sd_eps = c(0,
  0, 0), nsim = 100, family_method = "all", seed = 12345,
  show_progress = F, mc_cores = 1)

Arguments

obs

A single numeric value or a list with the number of observations in the simulated dataset.

rate

A single numeric value or a list with the survival rate. This should be a number between 0 and 1. The closer to 0 the stronger the pressure to be optimal.

sd

A single numeric value or a list with the standard deviation of noise term of the performance. A higher sd means that the decisions of interest are less important for performance.

d

A vector with two numeric values or a list of vectors. The quadratic effect of the two decisions that captures their the diminishing returns.

nsim

The number of simulations.

family_method

A single string or list of strings with the family and method of the tests to be run. Defaults to "all". Each string should be of the from "'family'_'method'" where 'family' can be "interaction" or "match". 'method' is ignored when family = "match" and can be set to "traditional" (without quadratic effects) or "augmented" (with quadratic effects) when family = "interaction"

seed

The seed can be set for reproducibility.

mc_cores

The number of cores to be used when running different simulations on different cores. That means that the core unit for parallelizing is a simulation.

b

A vector with four numeric values or a list of vectors. The contribution to performance of the two decisions of interest. A four element vector for the intercept, x1, x2, x1:x2

Details

This function allows to simulate data of the form

y ~ N(β_0 + β_1 x_1 + β_2 x_2 + β_3 x_1 x_2 - δ_1 {x_1}^2 - δ_2 {x_2}^2, σ)

.

The parameters β, δ, and σ can be set as parameters in the function. The simulated data are truncated based on the outcome y to simulate optimization by decision makers. The rate of survival determines the extent of truncation and thus the strenght of the optimazation.

The function allows to specify three different tests for the complementarity of x_1 and x_2. The first family of tests ignores the optimization and runs a regression according to the equation above. Traditionally, the quadratic terms are ignored. The augmented method allow for the inclusion of the quadratic terms. The second family of tests assumes optimal choices. As a result,

2 delta_1 x_1 = β_1 + beta_3 x_2

Typically, this matching approach does not estimate the δ_1 parameter. All tests can be done from this function directly. The function returns a single dataset for every test and parameter combination.

Value

A dataframe with test statistics and the parameters for each simulation and test.


stijnmasschelein/simcompl documentation built on May 30, 2019, 5:43 p.m.