simulate_mixture_cube: Simulate a mixture cube to test 'CVtreeMLE' against simulated...

View source: R/simulate_mixture_cube.R

simulate_mixture_cubeR Documentation

Simulate a mixture cube to test CVtreeMLE against simulated ground-truth.

Description

Simulate a mixture cube. This creates three correlated mixture variables that are associated with two confounders W1 and W2. First mixtures are generated from a multivariate normal. A multinomial outcome is generated based on betas input for W1 and W2 - associating each W with a part of the mixture cube. In each part of the mixture cube, transform the multivariate normal mixture to a uniform distribution, respecting the bounds for parts of the cube. A three variable cube with one threshold per variable has 8 subspaces. An outcome is then generated as a linear combination of different subspaces.

Usage

simulate_mixture_cube(
  n_obs = 500,
  splits = c(0.99, 2, 2.5),
  mins = c(0, 0, 0),
  maxs = c(3, 4, 5),
  mu = c(0, 0, 0),
  sigma = matrix(c(1, 0.5, 0.8, 0.5, 1, 0.7, 0.8, 0.7, 1), nrow = 3, ncol = 3),
  w1_betas = c(0, 0.01, 0.03, 0.06, 0.1, 0.05, 0.2, 0.04),
  w2_betas = c(0, 0.04, 0.01, 0.07, 0.15, 0.1, 0.1, 0.04),
  mix_subspace_betas = c(0, 0.08, 0.05, 0.01, 0.05, 0.033, 0.07, 0.09),
  subspace_assoc_strength_betas = c(1, 1, 1, 1, 1, 1, 1, 7),
  marginal_impact_betas = c(0, 0, 0),
  eps_sd = 0.01,
  binary = FALSE
)

Arguments

n_obs

Number of observations for which to generate data

splits

Vector indicating where thresholds should be placed for each mixture variable

mins

Vector indicating the minimum values for each mixture variable

maxs

Vector indicating the maximum values for each mixture variable

mu

Vector indicating the mean values for each mixture variable

sigma

Matrix of the variance-covariance structure used to generate the mixture variables

w1_betas

Vector of betas that define the subspace probability relationship with covariate W1

w2_betas

Vector of betas that define the subspace probability relationship with covariate W2

mix_subspace_betas

Vector of betas that define the subspace probabilities

subspace_assoc_strength_betas

The outcome Y generated by each partition of the mixture cube

marginal_impact_betas

Vector of betas that define the marginal impact each mixture variable has

eps_sd

Random error included in the generation of Y

binary

TRUE/FALSE depending on if the outcome should be binary

Value

obs: A data frame of the simulated data for the mixture cube.


blind-contours/CVtreeMLE documentation built on June 22, 2024, 8:53 p.m.