
Message/Author 

xiaotong li posted on Thursday, March 10, 2016  12:19 pm



Hi, I am modeling a multilevel SEM model to test mediator m but the code generated several errors. Could you help me with this issue? The input is: VARIABLE: NAMES ARE ID group x m y; MISSING ARE ALL (9999); USEVARIABLES ARE ID x m y; CLUSTER IS id; ANALYSIS: TYPE IS TWOLEVEL RANDOM; ALGORITHM=INTEGRATION; INTEGRATION=MONTECARLO(500); MODEL: %WITHIN% sa  m ON x; sb  y ON m; sc  y ON x; %BETWEEN% sa sb sc x m y; sa WITH sc x m y; sa WITH sb(cab); sb WITH sc x m y; sc WITH time m y; m ON x(ab); y ON m(bb); y ON x; [sa](aw); [sb](bw); The error are: *** ERROR in MODEL command Observed variable on the righthand side of a betweenlevel ON statement must be a BETWEEN variable. Problem with: x *** ERROR in MODEL command Observed variable on the righthand side of a betweenlevel ON statement must be a BETWEEN variable. Problem with: m *** ERROR in MODEL command Observed variable on the righthand side of a betweenlevel ON statement must be a BETWEEN variable. Problem with: x *** ERROR The following MODEL statements are ignored: * Statements in the BETWEEN level: m ON x y ON m y ON x Thank you for your help! 


Please send your output to Support along with your license number. 

anonymous posted on Sunday, September 18, 2016  12:41 pm



I am attempting to run the following model type: TITLE: 111 mediation (MSEM) DATA: FILE IS mydata.dat; ! text file containing raw data in long format VARIABLE: NAMES ARE id x m y; USEVARIABLES ARE id x m y; CLUSTER IS id; ! Level2 grouping identifier ANALYSIS: TYPE IS TWOLEVEL RANDOM; MODEL: ! model specification follows %WITHIN% ! Model for Within effects follows m ON x(aw); ! regress m on x, call the slope "aw" y ON m(bw); ! regress y on m, call the slope "bw" y ON x; ! regress y on x %BETWEEN% ! Model for Between effects follows x m y; ! estimate Level2 (residual) variances for x, m, and y m ON x(ab); ! regress m on x, call the slope "ab" y ON m(bb); ! regress y on m, call the slope "bb" y ON x; ! regress y on x MODEL CONSTRAINT: ! section for computing indirect effects NEW(indb indw); ! name the indirect effects indw=aw*bw; ! compute the Within indirect effect indb=ab*bb; ! compute the Between indirect effect OUTPUT: TECH1 TECH8 CINTERVAL; ! request parameter specifications, starting values, ! optimization history, and confidence intervals for all effects It runs fine, but according to Preacher, Zyphur, and Zhang it is recommended to first fit just the within model. How would I go about modifying this syntax to just fit the within model? 


In your case you have an unrestricted Betweenlevel model which means that this level has no misfit that would impact on the Withinlevel estimation. 

Back to top 

