theta_optim {COMMA}R Documentation

Likelihood Function for Normal Outcome Mechanism with a Binary Mediator

Description

Likelihood Function for Normal Outcome Mechanism with a Binary Mediator

Usage

theta_optim(param_start, m, x, c_matrix, outcome, sample_size, n_cat)

Arguments

param_start

A numeric vector or column matrix of starting values for the \theta parameters in the outcome mechanism and \sigma parameter. The number of elements in param_start should be equal to the number of columns of x_matrix and c_matrix plus 2 (if interaction_indicator is FALSE) or 3 (if interaction_indicator is TRUE). Starting values should be provided in the following order: intercept, slope coefficient for the x_matrix term, slope coefficient for the mediator m term, slope coefficient for first column of the c_matrix, ..., slope coefficient for the final column of the c_matrix, and, optionally, slope coefficient for xm). The final entry should be the starting value for \sigma.

m

A vector or column matrix containing the true binary mediator or the E-step weight (with values between 0 and 1). There should be no NA terms.

x

A vector or column matrix of the predictor or exposure of interest. There should be no NA terms.

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.

outcome

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

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

theta_optim returns a numeric value of the (negative) log-likelihood function.


[Package COMMA version 1.0.0 Index]