Skip to contents

Function is for cases with \(Y \sim Poisson\) and without an interaction term in the outcome mechanism.

Usage

EM_function_poissonY(
  param_current,
  obs_mediator,
  obs_outcome,
  X,
  Z,
  c_matrix,
  sample_size,
  n_cat
)

Arguments

param_current

A numeric vector of regression parameters, in the order \(\beta, \gamma, \theta\). The \(\gamma\) vector is obtained from the matrix form. In matrix form, the gamma parameter matrix rows correspond to parameters for the M* = 1 observed mediator, with the dimensions of Z. In matrix form, the gamma parameter matrix columns correspond to the true mediator categories \(j = 1, \dots,\) n_cat. The numeric vector gamma_v is obtained by concatenating the gamma matrix, i.e. gamma_v <- c(gamma_matrix).

obs_mediator

A numeric vector of indicator variables (1, 2) for the observed mediator M*. There should be no NA terms. The reference category is 2.

obs_outcome

A vector containing the outcome variables of interest. There should be no NA terms.

X

A numeric design matrix for the true mediator mechanism.

Z

A numeric design matrix for the observation mechanism.

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 be NA.

sample_size

An integer value specifying the number of observations in the sample. This value should be equal to the number of rows of the design matrix, X or Z.

n_cat

The number of categorical values that the true outcome, M, and the observed outcome, M* can take.

Value

EM_function_bernoulliY returns a numeric vector of updated parameter estimates from one iteration of the EM-algorithm.