Learn R Programming

polle (version 1.6.2)

sim_single_stage: Simulate Single-Stage Data

Description

Simulate Single-Stage Data

Usage

sim_single_stage(
  n = 10000,
  par = c(k = 0.1, d = 0.5, a = 1, b = -2.5, c = 3, p = 0.3),
  action_model = function(Z, L, B, k, d) {
     k * (Z + L - 1) * Z^(-2) + d * (B == 1)

}, utility_model = function(Z, L, A, a, b, c) { Z + L + A * (c * Z + a * L + b) }, seed = NULL, return_model = FALSE, ... )

Value

data.frame with n rows and columns Z, L, B, A, and U.

Arguments

n

Number of observations.

par

Named vector with distributional parameters.

  • k: \(\kappa\)

  • d: \(\delta\)

  • a: \(\alpha\)

  • b: \(\beta\)

  • c: \(\gamma\)

  • p: \(\pi\)

action_model

Function used to specify the action/treatment probability (logit link).

utility_model

Function used to specify the conditional mean utility.

seed

Integer.

return_model

If TRUE, the lava::lvm model is returned.

...

Additional arguments passed to lava::lvm().

Details

sim_single_stage samples n iid observation \(O = (B, Z, L, A, U)\) with the following distribution: $$ B \sim Bernoulli(\pi)\\ Z, L \sim Uniform([0,1])\\ A\mid Z,L,B \sim Bernoulli(expit\{\kappa Z^{-2}(Z+L-1) + \delta B)\\ U\mid Z,L,A \sim \mathcal{N}(Z+L+A\cdot\{\gamma Z + \alpha L + \beta\}, 1) $$