Generate Bootstrap Samples for Estimating Standard Errors
COMMA_boot_sample.Rd
Generate Bootstrap Samples for Estimating Standard Errors
Usage
COMMA_boot_sample(
parameter_estimates,
sigma_estimate = 1,
outcome_distribution,
interaction_indicator,
x_matrix,
z_matrix,
c_matrix
)
Arguments
- parameter_estimates
A column matrix of \(\beta\), \(\gamma\), and \(\theta\) parameter values obtained from a COMMA analysis function. Parameter estimates should be supplied in the following order: 1) \(\beta\) (intercept, slope), 2) \(\gamma\) (intercept and slope from the M = 1 mechanism, intercept and slope from the M = 2 mechanism), and 3) \(\theta\) (intercept, slope, coefficient for
x
, slope coefficient form
, slope coefficient forc
, and, optionally, slope coefficient forxm
if using).- sigma_estimate
A numeric value specifying the estimated standard deviation. This value is only required if
outcome_distribution
is"Normal"
. Default is 1. For non-Normal outcome distributions, the value should beNULL
.- outcome_distribution
A character string specifying the distribution of the outcome variable. Options are
"Bernoulli"
,"Normal"
, or"Poisson"
.- interaction_indicator
A logical value indicating if an interaction between
x
andm
should be used to generate the outcome variable,y
.- x_matrix
A numeric matrix of predictors in the true mediator and outcome mechanisms.
x_matrix
should not contain an intercept and no values should beNA
.- z_matrix
A numeric matrix of covariates in the observation mechanism.
z_matrix
should not contain an intercept and no values should beNA
.- c_matrix
A numeric matrix of covariates in the true mediator and outcome mechanisms.
c_matrix
should not contain an intercept and no values should beNA
.
Value
COMMA_boot_sample
returns a list with the bootstrap sample data:
- obs_mediator
A vector of observed mediator values.
- true_mediator
A vector of true mediator values.
- outcome
A vector of outcome values.
- x_matrix
A matrix of predictor values in the true mediator mechanism. Identical to that supplied by the user.
- z_matrix
A matrix of predictor values in the observed mediator mechanism. Identical to that supplied by the user.
- c_matrix
A matrix of covariates. Identical to that supplied by the user.