Message/Author 

Stanislaw posted on Friday, August 21, 2020  5:41 am



Dear all, I would like to test a twolevel model with categorical predictors and binary dependent variable (0/1). All three variables are expected theoretically to be on both levels, thus, I did not specify whether a variable was between or within only. However, the program was terminated and I received the error message: "An x variable is not declared as within or between only. Latent variable decomposition of an x variable is not available using ALGORITHM=INTEGRATION unless the variable is turned into a y variable by mentioning its variance." A part of the syntax is: variable: usevariables = a X1 X2 Y; cluster = a; categorical = Y; analysis: type = twolevel random; estimator=mlR; link = logit; model: %within% Y on X1 X2; %between% Y on X1 X2; The syntax works if I declare X1 and X1 as within variables in the command variable. I would be very grateful, of you can help me. 


I assume you use version 8.4. Try  dropping "random" in your Type statement  add on within: x1 x2;  or change to Estimator=Bayes 

Stanislaw posted on Sunday, August 23, 2020  4:58 am



Thank you! The syntax works if I perform all three suggestions and drop down "link = logit". (otherwise errors appeared). If I understan well, splitting variance while using ordinal variables is prossible only if I use two level analysis with bayes estimatior and probit as a link function. To be sure two questions: 1. Is possible to use logit function and ml as estimatator in case of ordinal variables? 2. Can you reccomend a book in which I can read specifically how to set up the two level model for ordinal variables and interprete the Mplus outcome? (I looked in to Heck and Scott, 2015 "Introduction into multilevel modelling ...", but it is not informative in case when the same variables are on both between and within levels.) 


This book might help https://books.google.com/books?hl=en&lr=&id=yElZBwAAQBAJ&oi=fnd&pg=PP1&dq=info:EsW1LaxtuPEJ:scholar.google.com&ots=GZqSbOMiK8&sig=0Kw_L4lAz9bRhvaEzQ2cyH9HDo4#v=onepage&q&f=false In your syntax so far you have not declared x1 and x2 as categorical and that makes a difference because, unlike in the continuous case there are two fairly different models/ model interpretations for the within level part. Take a look at the predictor option on page 703 in the User's Guide, you won't be able to use that option here but it might help you understand the difference. You basically have 4 tings to consider (in order of importance): predictor scale (latent or observed)/centering (latent or observed)/estimator(bayes,ml,wlsmv)/link(probit,logit). So in total there are 24 options, and there are more if multiple group modeling is also considered or if you want to consider treat the covariates as continuous. We currently don't have a document that discusses these in enough introductory detail. Not knowing anything about your application, the simplest thing to do is: treat the covariates as continuous, use observed centering, estimator=ml, link=logit. 

Stanislaw posted on Tuesday, August 25, 2020  1:24 am



Dear Tihomir, thank you! I tried the simplest model that you suggested (treating ordinal x1 and x2 as contineous). However, I was not sure how I can bring "observed centerning" and into the model and whether it is esential for contineous x1 and x2. The syntax was: variable: usevariables = a X1 X2 Y; cluster = a; categorical = Y; analysis: type = twolevel; estimator=ml; link = logit; model: %within% Y on X1 X2; X1 X2; %between% Y on X1 X2; Unfortunately the same error appear: "An x variable is not declared as within or between only. Latent variable decomposition of an x variable is not available using ALGORITHM=INTEGRATION unless the variable is turned into a y variable by mentioning its variance." What I did wrong? 


Here are some options  these all run the same model  Title: Here you can use wlsmv or bayes. Latent centering/ probit based ANALYSIS: TYPE = TWOLEVEL; ESTIMATOR = wlsmv; MODEL: %WITHIN% y ON x1 x2; x1 with x2; %BETWEEN% y ON x1 x2; x1 with x2;  Title: Observed centering. You can use bayes/wlsmv/ml. In ML you can switch between logit and probit. VARIABLE: NAMES ARE y x1 x2 clus; CATEGORICAL = y; CLUSTER = clus; usevar = y x1 x2 x1b x2b; within=x1 x2; between=x1b x2b; define: center x1(groupmean); center x2(groupmean); x1b=cluster_mean(x1); x2b=cluster_mean(x2); ANALYSIS: TYPE = TWOLEVEL; ESTIMATOR = ml; link=probit; MODEL: %WITHIN% y ON x1 x2; %BETWEEN% y ON x1b x2b;  Title: Latent hybrid centering with ML(predictors on the within level are uncentered). You can switch between logit and probit. ANALYSIS: TYPE = TWOLEVEL; ESTIMATOR = ML; link=probit; MODEL: %WITHIN% y ON x1 x2; x1 with x2; %BETWEEN% y ON fx1 fx2; x1@0; x2@0; fx1 by x1@1; fx2 by x2@1; fx1 with fx2; For further references http://www.statmodel.com/download/CenteredMediation.pdf 

Tay Jeong posted on Tuesday, August 25, 2020  12:45 pm



Just a passersby chiming in: I'm so glad I found the last post by Dr.Asparouhov. I for some reason was assuming there would be no way to do hybrid centering with a categorical outcome,but apparently it can be done by creating B components fx1 and fx2 that loads perfectly on x1 and x2. Thank you for posting! 

Stanislaw posted on Monday, August 31, 2020  7:11 am



Dear Tihomir, thank you very much for the syntaxes and a paper about centering. They are a great help! I decided to use the observed centering with estimator = ml, as it seems to me the most easy one. My questions for this type of analysis are: 1. The odds ratios are offered on within level. In case of observed centering (odds ratio of 2; Y is 0 or 1; X is a continuous variable with levels 1, 2, 3, 4 and 5), I understand the odds ratio of 2 as the following: If X changers in one unit than odds of Y to become 1 increase in twofold. But what is the unit in case of observed centering for X? Is it in this case simply a change e.g., from 2 to 3? 2. There is no odds ratios on the between level. Thus, I try to understand how to interpret the unstandardized regressions on the between level for categorical Y. For example if ß=1.5, how strong does Y increase if X1 increase in 1 unit on between level (e.g. from 2 to 3)? Is this type of interpretation possible or one is stucked with the significance of ß and can not interpret it on the between level? 


1. With groupmean centering, for each group, a 1unit change in X is the same after centering. 2. On Between, Y is a continuous random intercept so you interpret effects like in linear regression. 

Back to top 