
Generate Data to use in COMBO Functions
COMBO_data.RdGenerate Data to use in COMBO Functions
Arguments
- sample_size
An integer specifying the sample size of the generated data set.
- x_mu
A numeric value specifying the mean of
xpredictors generated from a Normal distribution.- x_sigma
A positive numeric value specifying the standard deviation of
xpredictors generated from a Normal distribution.- z_shape
A positive numeric value specifying the shape parameter of
zpredictors generated from a Gamma distribution.- beta
A column matrix of \(\beta\) parameter values (intercept, slope) to generate data under in the true outcome mechanism.
- gamma
A numeric matrix of \(\gamma\) parameters to generate data under in the observation mechanism. In matrix form, the
gammamatrix rows correspond to intercept (row 1) and slope (row 2) terms. The gamma parameter matrix columns correspond to the true outcome categories \(Y \in \{1, 2\}\).
Value
COMBO_data returns a list of generated data elements:
- obs_Y
A vector of observed outcomes.
- true_Y
A vector of true outcomes.
- obs_Y_matrix
A numeric matrix of indicator variables (0, 1) for the observed outcome
Y*. Rows of the matrix correspond to each subject. Columns of the matrix correspond to each observed outcome category. Each row contains exactly one 0 entry and exactly one 1 entry.- x
A vector of generated predictor values in the true outcome mechanism, from the Normal distribution.
- z
A vector of generated predictor values in the observation mechanism from the Gamma distribution.
- x_design_matrix
The design matrix for the
xpredictor.- z_design_matrix
The design matrix for the
zpredictor.
Examples
set.seed(123)
n <- 500
x_mu <- 0
x_sigma <- 1
z_shape <- 1
true_beta <- matrix(c(1, -2), ncol = 1)
true_gamma <- matrix(c(.5, 1, -.5, -1), nrow = 2, byrow = FALSE)
my_data <- COMBO_data(sample_size = n,
x_mu = x_mu, x_sigma = x_sigma,
z_shape = z_shape,
beta = true_beta, gamma = true_gamma)
table(my_data[["obs_Y"]], my_data[["true_Y"]])
#>
#> 1 2
#> 1 258 45
#> 2 63 134