Skip to main content
. Author manuscript; available in PMC: 2016 Sep 1.
Published in final edited form as: Eval Health Prof. 2013 Dec 2;38(3):315–342. doi: 10.1177/0163278713512124
Code for the Logistic Regression-Based DTSM
 TITLE: (a)
  Logistic regression-based DTSM Example;
 DATA: (b)
  FILE IS example1.txt;
 VARIABLE: (c)
  NAMES ARE x m y5 y6 y7 y8 y9 event;
  USEVARIABLES ARE x m y5 y6 y7 y8 y9 event;
  CATEGORICAL = event;
  MISSING ARE ALL (−999);
 ANALYSIS: (d)
  TYPE = GENERAL;
  ESTIMATOR = MLR;
  LINK = LOGIT;
  ALGORITHM = INTEGRATION EM;
  INTEGRATION = MONTECARLO (500);
 MODEL: (e)
  [x];
  x;
  m ON x (p1);
  [m];
  m;
  event ON x (p2) m (p3) y5 y6 y7 y8 y9@0;
 MODEL CONSTRAINT: (f)
  NEW (ab);
  ab = p1 * p3;
 OUTPUT: (g)
  SAMPSTAT;
  CINTERVAL;
Programming Notes:
(a)

In the TITLE command make a title for the analysis.

(b)

In the DATA command specify the data file. If the file is in the same location as the Mplus input file there is no need to specify a file path.

(c)

In the VARIABLE command name the variables as they appear in the dataset, specify the binary indicator indicating whether the event occurred in the observation period of Y as categorical, and identify the missing value code. If there are variables in the dataset that will not be estimated in the model, specify a subset of variables to use for analysis with the usevariables command.

(d)

In the ANALYSIS command specify a general model with ML estimation and robust standard errors; use a logit link function and the integration expectation maximization algorithm. Note that integration is necessary to deal with missing data on X. Specify the number of integration points to estimate in parentheses; we chose 500.

(e)

In the MODEL command estimate the mean and variance of X so that the program will treat it as endogenous and handle missing data on the variable. Estimate the a path of the mediation model by regressing M on X. Name the parameter in parentheses; we chose“p1.” Estimate the mean and variance of M. Regress the event outcome on X, M and the five time points of Y. Name the b and c’ parameters; we chose “p2” and “p3” respectively, and fix the loading associated with y9 to identify the reference group for time.

(f)

In the MODEL CONSTRAINT command define the indirect effect by creating a new variable and naming it in parentheses; we chose “ab.” Calculate the variable by computing the product of the p1 and p3 parameter estimates.

(g)

In the OUTPUT command specify sample statistics, confidence limits and any other information you deem useful.