

Twolevel mediation analysis with bin... 

Message/Author 


Hi, I am trying to test mediation using a 112 model where the outcome is binary. I specified the model following Preacher's syntax (see below) but with the outcome variable specified as 'categorical'. When I run the model, I get a number of error messages: ***ERROR in MODEL command Observed variable on the righthand side of a betweenlevel ON statement must be a BETWEEN variable. Problem with: X1 (this is repeated for x1, x2, and M) *** ERROR in MODEL command Variances for betweenonly categorical variables are not currently defined on the BETWEEN level. Variance given for: U1 *** ERROR The following MODEL statements are ignored: * Statements in the BETWEEN level: M ON X1 M ON X2 U1 ON M U1 ON X1 U1 ON X2 When I run the same model but treat the outcome variable as continuous (which I know is inappropriate, but I just wanted to see whether it would work), I get a full solution and no errors. Any help would be appreciated! relevant parts of syntax: USEVARIABLES ARE subject x1 x2 m u1; CLUSTER IS subject; between are u1; categorical = u1; ANALYSIS: TYPE IS TWOLEVEL; %WITHIN% m ON x1; m on x2; x1 with x2; %BETWEEN% u1; m ON x1; m ON x2; u1 ON m; u1 ON x1; u1 ON x2; x1 with x2; 


You can try putting a factor behind x1, m, and x2 on the between level and using the factor instead of the observed variable in the analsyis, for example, f1 BY x1@1; x1@0; This makes the factor equal to x1. 

Back to top 

