Skip to content

Commit 7b92f61

Browse files
20260202 - multilevel SEM model
1 parent 319d299 commit 7b92f61

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

mplus.qmd

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,8 @@ DATA:
841841
842842
VARIABLE:
843843
NAMES = PersonID sex A B time timesq; ! List of variables in data file
844-
USEVARIABLE = sex A B time timesq; ! Variables to be analyzed in this model
845-
MISSING ARE ALL (-999); ! Missing data identifier
844+
MISSING = .; ! Missing data identifier
845+
USEVARIABLES = sex A B time timesq; ! Variables to be analyzed in this model
846846
! MLM options
847847
CLUSTER = PersonID; ! Level-2 ID
848848
BETWEEN = sex; ! Observed ONLY level-2 predictors
@@ -853,9 +853,10 @@ ANALYSIS:
853853
TYPE = TWOLEVEL RANDOM;
854854
ESTIMATOR = BAYES;
855855
BITERATIONS = 50000;
856-
857-
OUTPUT:
858-
TECH8; ! Used to examine convergence
856+
CHAINS = 4; ! number of chains
857+
PROCESSORS = 4; ! number of computer processors to use
858+
BSEED = 52242; ! set seed for replicability
859+
STVALUES = ml; ! set starting values based on ML estimation
859860
860861
MODEL: ! A = construct 1; B = construct 2
861862
%WITHIN%
@@ -881,6 +882,15 @@ MODEL CONSTRAINT:
881882
! STD = Unstd * SQRT(Xvar) / SQRT(Yvar)
882883
A2Bsd = ABLagEff * SQRT(8.3538) / SQRT(0.08077); ! STD A->B lagged effect
883884
B2Asd = BALagEff * SQRT(0.08077) / SQRT(8.3538); ! STD B->A lagged effect
885+
886+
OUTPUT:
887+
STAND; ! standardized estimates
888+
TECH1; ! model priors
889+
TECH8; ! potential scale reduction (PSR); to evaluate convergence (should be near one)
890+
CINTERVAL; ! posterior predictive intervals (credible intervals)
891+
892+
PLOT:
893+
TYPE = PLOT3; ! trace plots, histogram, and kernel density
884894
```
885895

886896
Further extensions:

0 commit comments

Comments
 (0)