Message/Author 


Are random intercepts at the between level the default for Mplus twolevel models? If so, are the intercepts random by default for observed and latent variables? 


The answer to both of your questions is yes. 

bobh posted on Friday, June 11, 2004  2:06 pm



How do I specify a twolevel random intercepts (fixed slopes) model in Mplus? 


I have adapted the ANALYSIS and MODEL commands of Example 9.1 from the Mplus User's Guide to have a fixed slope. ANALYSIS: TYPE = TWOLEVEL; MODEL: %WITHIN% y ON x; %BETWEEN% y ON w; 

Bobh posted on Sunday, June 13, 2004  8:58 am



I don't have a betweenlevel covariate, W. Will this work? ANALYSIS: TYPE = TWOLEVEL; MODEL: %WITHIN% y ON x; %BETWEEN% y; 

bmuthen posted on Sunday, June 13, 2004  9:48 am



Yes. And, you don't have to mention y in the between part  its mean and variance will be estimated as the default. 


groupcentering (x); ANALYSIS: TYPE = TWOLEVEL; MODEL: %WITHIN% y ON x; %BETWEEN% y; can this command work? 

bmuthen posted on Friday, June 18, 2004  8:45 am



Yes. Except that your centering statement does not use the right grammar, it should be centering = groupmean(x); And, grandmean centering is perhaps more common. 


Dr.Muthen, following is my command, i wanna center the X variable in each group like the HLM "ADD vatiable cetering on group" doing, but MPLus SAY it can not work, what is the problem? thanks, boliang BETWEEN = od; centering = groupmean (bad10); CLUSTER IS class; ANALYSIS: TYPE = TWOLEVEL RANDOM Missing H1; ALGORITHM = INTEGRATION; INTEGRATION = 10; MODEL: %WITHIN% snewac ON bad10; bad10 ON newac@0; %BETWEEN% bad10 newac ON od; output: sampstat TECH1 TECH8; *** ERROR in Variable command GROUPMEAN centering can be applied to WITHIN variables only. Unable to center variable: BAD10 


You need to add WITHIN = BAD10; to the VARIABLE command. 


even I add the withn = bad10, the command can not work too. following is the command and the error message. thanks for your attention and help. USEVARIABLES ARE bad10 newac od class; MISSING IS *; WITHIN = BAD10; BETWEEN = od; centering = groupmean (bad10); CLUSTER IS class; ANALYSIS: TYPE = TWOLEVEL RANDOM Missing H1; ALGORITHM = INTEGRATION; INTEGRATION = 10; MODEL: %WITHIN% snewac ON bad10; bad10 ON newac@0; %BETWEEN% bad10 newac ON od; output: sampstat TECH1 TECH8; *** ERROR in Model command Withinlevel variables cannot be used on the between level. Withinlevel variable used: BAD10 

bmuthen posted on Sunday, June 20, 2004  9:14 pm



You have bad10 as an x variable on Within and as a y variable on Between  is that your intention? If you want bad10 to have Between variation you cannot use the centering command. In such a situation you need to center the variable yourself  you can use the Define command. 

Anonymous posted on Monday, January 10, 2005  8:51 am



I want to run a twolevel model with a random intercept and a random slope but no level 2 covariates. The code I used is ANALYSIS: Type = Twolevel Random; Algorithm = Integration; MODEL: %WITHIN% a  y on x; y*1; %BETWEEN% [a*.6]; a*.160; The problem is that I get the error message: *** WARNING in Model command Variable on the lefthand side of an ON statement in a  statement is a WITHIN variable. The intercept for this variable is not random. Variable: Y I want this intercept to be random, but can't seem to find a statement to make it random. What should I put in my program file to do this? From your reply to an ealier post, I thought this would be put in by default, but clearly that's not happening here. Sorry if this is a boneheaded question. 


It sounds like you are putting y on the WITHIN list. You should not do this. 

Anonymous posted on Monday, January 24, 2005  2:40 pm



Dr. Muthen, I am trying to use longitudinal growth curve model to analyze our data which is clustered. However, we don't have a betweenlevel covariate. So here's the modelI am trying to fit: y_{ijt} = a_{ij}+ b_{ij}t_{ij} + e_{ijt}, a_{ij} = a1_{j} + b1*x_{ij} + e1_{ij}, b_{ij} = a2_{j} + b2* x_{ij} + e2_{ij}, a1_j = a3 + e3_j, a2_j = a4 + e4_j, where subscripts i is for individual, j is for school and t is for time. Outcome variable is denoted as y_{ijt}, subject level covariates is x_{ij}. By reading the User's Guide, I wrote down the following code: VARIABLE: NAMES ARE school x1 x2 x3 x4 y1 y2 y3 y4 y5; USEV = x1 x2 x3 x4 y1 y2 y3 y4 y5 school; CLUSTER = school; ANALYSIS: TYPE = TWOLEVEL RANDOM; MODEL: %WITHIN% iw sw  y1@0 y2@1 y3@2 y4@4 y5@8; iw ON x1 x2 x3 x4; sw ON x1 x2 x3 x4; %BETWEEN% ??? However, it is not clear for me how to specify the school effect in the %BETWEEN% part of the model. Could you provide any guide on this? thanks a lot for your help. 

bmuthen posted on Monday, January 24, 2005  6:04 pm



The Between part of the model should be ib sb  y1@.... (as on Within)  here ib and sb are your a1_j and a2_j effects. If you write out your first equation including the terms of a1_j and a2_j you see that this makes sense (they form a growth model on between). Try it out and check that you get the parameters you expect (and only those). 

Anonymous posted on Tuesday, January 25, 2005  12:42 pm



Dr. Muthen, Thanks so much for your answer. However, I tried the following code: MODEL: %WITHIN% iw sw  y1@0 y2@1 y3@2 y4@4 y5@8; iw sw ON x1 x2 x3 x4; %BETWEEN% ib sb  y1@0 y2@1 y3@2 y4@4 y5@8; and get the following error messages for each of the x's: *** WARNING in Model command Variable is uncorrelated with all other variables on the BETWEEN level: X1 *** ERROR in Model command Variable is a yvariable on the BETWEEN level but is an xvariable on the WITHIN level: X1 All the x's are dichotomous. Can you point out why I get these error messages? Thank you very much for your help. 


You don't have any x's on the between level so you should declare them as within only by putting them on the WITHIN list in the VARIABLE command. This is just a warning to let you know this. 

Anonymous posted on Wednesday, January 26, 2005  9:04 am



Dr. Muthen, Thanks for pointing this out. It works. 


Hello Bengt and Linda, Searching the Mplus dicussion board I found a posting with its reply from 4 years ago. (i have attached it below). My question is in regards to Bengt's answer "In Version 3 of Mplus, random slopes for observed covariates will be included.", Does version 3 handles random slopes for latent covariates? "Hello  I am learning Mplus so that I can estimate some multilevel path models, but I'm afraid I've gotten confused. In a standard mixed regression model, you can estimate a level1 regression where x_1 and x_2 predict y, and it is possible to get random components for the intercept and both regression parameters over level2 units. However, as best as I can tell, in Mplus it is only possible to get a random intercept but NOT random slopes in the same situation. Is there a straightforward way to understand why this is so? Is the answer to this the same reason why in a multilevel CFA in Mplus you can only get random intercepts in the indicators but the factor loading matrices are forced to be invariant across level2 units? Thank you very much. Bengt O. Muthen posted on Wednesday, November 14, 2001  6:52 am You are correct that random slopes are not part of the Mplus multilevel model for crosssectional data. Latent variable modeling has traditionally considered mean and covariance structure models. With random slopes, there is no one covariance structure, but the covariance structure changes for each covariate value. See, for example, the Raudenbush chapter in the Collins, Sayer book. In Version 3 of Mplus, random slopes for observed covariates will be included." 


Yes. 

Oliver posted on Monday, February 13, 2006  5:59 am



I have a question regarding the interpretation of regression coefficients in randomintercept models in Mplus. I am interested in a simple twolevel model with one independent variable on level 1 X_ij and the corresponding aggregrated scores on level 2 X_.j. In HLM notation the model could be written as: Y_ij = b_0j + b_1j * X_ij + e_ij b_0j = g_00 + g_01 * X_.j + u_0j b_1j = g_10 The obvious way to specify this model in Mplus would be 1) Mplus model %within% Y on X; %between% Y on X; Now I am not sure how to interpret the regression coefficient on level2. Is the level1 predictor variable groupmean centered or grandmean centered? So I specified two additional models using the centering option in Mplus. 2) grandmean centered within = X; between = X_average; centering = grandmean(X); %within% Y on X; %between% Y on X_average; 3) groupmean centered within = X; between = X_average; centering = groupmean(X); %within% Y on X; %between% Y on X_average; I compared the level2 regression coefficient of model 1 (“Mplus”model) to the ones I obtained when I use the centering options – and which I could replicate in an HLM analysis. Interestingly, the value of the level2 regression coefficient for the “Mplus” model was not near to the coefficient of the grandmean or of the groupmean centered model. a) How would you interpret the level2 coefficient in model 1? b) Could you explain to me how the level2 regression coefficient in model 1 is related to the level2 coefficients in model 2 and model 3? c) Given that the interpretation of the level2 coefficient in model 2 and model 3 is well established in the multilevel literature, could you imagine a data constellation in which you would recommend using the coefficient of model 1? Thank you very much for your help! 

bmuthen posted on Tuesday, February 14, 2006  4:59 pm



Model 1 in Mplus takes x to be a variable with both within and betweenlevel variation, decomposing the variable into two orthogonal components, thereby using an estimated betweenlevel component of x as the betweenlevel predictor. This betweenlevel predictor has a mean, so is not centered. This betweenlevel variable is approximately the same as a variable created from the clustermeans for x (perhaps that is your approach/model 2, except you subtract the overall mean?). The difference is that with unbalanced data (different cluster sizes) the Model 1 approach may be more robust to outliers in that a small cluster with an outlier mean will be downweighted using a normality assumption. I think the Raudenbush & Bryk book talks about related issues in terms of "precisionweighted means". I'd be interested in seeing your application if you get large differences between 1 and 2. 

Oliver posted on Friday, February 17, 2006  2:17 am



Dear Dr. Muthen, I created a balanced data set by randomly selecting 10 students out of each class. My data set contains 76 classes. The dependent variable is a standardized mathematics achievement test (ICC = .52) and the independent variable is the student perception of disruptions during the lesson (ICC = .26). I also aggregated the student perceptions for every class across students and included the class means into the model on level2 (only for Model 2 and 3). This model is essentially the contextual analysis model discussed by Raudenbush and Bryk in chapter 5 of their book. I obtained the following results for the three models (unstandardized coefficients, standard errors in brackets): Model 1 (Mplus) Analysis: Type is twolevel; Model: %within% math on disruption; %between% math on disruption; g10 = .095 (.060) g01 = .863 (.338) Model 2 (grandmean centered, a_disruption is the aggregated class mean) within = disruption; between = a_disruption; centering = grandmean(disruption); Analysis: Type is twolevel; Model: %within% math on disruption; %between% math on a_disruption; g10 = .094 (.044) g01 = .608 (.263) Model 3 (groupmean centered) within = disruption; between = a_disruption; centering = groupmean(disruption); Analysis: Type is twolevel; Model: %within% math on disruption; %between% math on a_disruption; g10 = .095 (.065) g01 = .701 (.263) Model 2 and Model 3 show the expected relationship between the coefficients (Raudenbush & Bryk, 2002, p. 139). The contextual effect g01 in Model 2 is (almost) equal to the result of subtracting the coefficients in Model 3: .608 = .701 – (.095). But it is difficult for me to interpret the level2 regression coefficient (g01) in Model 1. You said that Model 1 decomposes the independent variable into two orthogonal components; but isn’t that the idea of groupmean centering (Model 3)? Thank you very much for your help! 

bmuthen posted on Friday, February 17, 2006  5:09 pm



Since this topic is of general interest, we decided to give you a fuller answer by writing up a little note on this. It will be available shortly. 

bmuthen posted on Friday, February 24, 2006  6:44 pm



Tihomir Asparouhov has taken the lead on writing a note on this topic. If you send us your email address to support@statmodel.com, we will send the pdf to you. Later on, it will be posted together with Mplus Monte Carlo simulation runs. The message of the note is that Model 1 (in your notation above) is the best way to approach this analysis. The other approaches can give biases in the betweenlevel slope and therefore also in the "compositional effect". The bias increases when the cluster size decreases and when the ratio of within to between variance for x increases. This is perhaps a little known fact so the note should help. In many applications, however, the bias is expected to be small. Could you make your data available to us? 


I think I have a very basic question. I want to do twolevel logistic regression analyses and after running the model, I want to get a predicted probability based on the model, but holding several variables at a particular constant (like their respective means) while allowing variation for other independent variables of interest. For example, I want to see the probability of dropping out of high school and how it varies by race/ethnicity and years of education of their mother, while holding constant gender and socioeconomic status at their means (or mode). Can Mplus do it? If it does, how? Thank you! 


No, Mplus does not do this. 


After running a multigroup multilevel regression with random slopes I get two influence (outliers) measures OUTINFL and OUTINFLC. ¿Whats the meaning of each of this measures (I hoped only one)? Many Thanks. 


OUTINFL is for the withinlevel outliers and outinflc is for betweenlevel outliers. 


Regarding a post above from 17 Feb 2006: Is it okay when the contextual effect is not exactly equal to the difference of the between and within coefficients? It seems that most examples I see, such as in Bryk and Raudenbush (1992:122) and Snijders and Bosker (1999:87), they are always exactly equal. When I use Mplus they are often off by a couple of thousandths (sometimes as much as a hundredth). 


They are exactly equal because that is how the contextual effect is defined and computed  you may be misinterpreting the results. Please send your output and license number to support@statmodel.com if you want help on this. 

Paola posted on Friday, January 22, 2010  7:44 am



Dear Linda, I am running a random intercept model on a longitudinal data set in long format, this is the code BETWEEN= chd sex sexchd; WITHIN = alcoh depres age agesq; CLUSTER = id; Define: sexchd=chd*sex; ANALYSIS: TYPE = TWOLEVEL; estimator=ml; MODEL: %WITHIN% qol ON age agesq alcoh depres; alcoh depres; /to use all available data/ %BETWEEN% qol ON chd sex sexchd; I would like to know what kind of covariance matrix structure mplus uses when I have the data in long format for the random intercept model (I assume is independent, but I am not sure), and what the difference would be in the covariance matrix structure if I set the data to be in wide format. Also how can I obtain the covariance matrix? is it output:tech4 correct? 


The setup looks correct. With long format residual variances of the outcome and regression coefficients of the timevarying covariates are equal across time. With wide format, they are not. 

Paola posted on Friday, January 22, 2010  11:39 am



Thank you Linda, is there a way to set up the variances non to be equal across time when analysing this data in long format? 


No. 


Hello, I know this topic was discussed some years ago but I'm trying to sort this out for myself. If I model an observed variable X on both the within and the between level the between level variable is a random intercept. Could you elaborate on what the intercept refers to and how it is formed by mplus? I'm trying to figure out how the mplus approach differs from using cluster means at the between level and centering the within variable? As always, I appreciate your kind help! 


It's really a random mean in your setting. See slide 16  in the Topic 7 handout on our web site, where y takes the role of your x and eta takes the role of the latent betweenlevel part. Note that this is simply 1way random effects ANOVA. Also, you want to read: Lüdtke, O., Marsh, H.W., Robitzsch, A., Trautwein, U., Asparouhov, T., & Muthén, B. (2008). The multilevel latent covariate model: A new, more reliable approach to grouplevel effects in contextual studies. Psychological Methods, 13, 203229. which is on our web site. And you want to look at UG ex9.1. which describes this. 


Thank you Bengt! That does help a lot. It really is a good paper that makes this perfectly clear. 


Thanks again for your help. I have a short follow up question that I'm trying to figure out: 1  When I model a variable X on two levels as in example 9.1. without specifying the centering, how does mplus treat the within variable? Is it simply using the actual observed values or is it decomposing or centering this variable? 2  What would in this case be the advantage of centering a variable? 


1. Example 9.1 shows two approaches to handling x. In both approaches the variable is not modified in any way. 2. Centering is usually done to aid in interpretation, for example, in a regression the intercept of a centered variable becomes a mean. 


Thanks a lot Linda, Actually I have to correct myself. I am actually not mentioning my variable X on the within statement. Am I correct that: a) this means that the variable is then decomposed into two uncorrelated latent variables? b) this essentially involves a latent groupmean centering of the within level X? c) this is the MLC model discussed in Lüdtke, O., Marsh, H.W., Robitzsch, A., Trautwein, U., Asparouhov, T., & Muthén, B. (2008)? 


Yes, yes, and yes. 

Tor Neilands posted on Thursday, September 09, 2010  10:19 am



I am fitting a multiple groups multilevel regression model to longitudinal data with five groups. There is a single continuous outcome explained where time is represented by three linear spline variables whose values can vary within observations (within level). Remaining explanatory variables are measured at the subject (between) level. The goal of the analysis is to generate expected values of the outcome for each spline knot for each of the five groups and then to compare those expected values by defining new parameters representing their differences using MODEL CONSTRAINT, at the mean values of the other covariates. I read in the Mplus 6 documentation that Mplus can grandmean center variables, which is a great feature. I noticed that in multiple groups analysis the grandmean centering feature of Mplus will center observations around the group's mean rather than the overall mean for the whole sample. I was curious to know what the thinking was behind setting up the grandmean centering feature of Mplus in this way? I would think for my type of application I would want to grandmean center using the whole sample mean so as not to introduce bias in the group comparisons of the outcome, but wanted to make sure I wasn't missing a reason to use the withingroups means instead for grandmean centering? Thanks for any insights you can share. Tor Neilands 


Each group represents a different population so in line with standardizing using each group's standard deviations, centering is done using each groups means. You can use the DEFINE command to center using the overall mean if you want to. 


I wanted to use example 9.1, as modified in the posting above, for a random interceptonly model, as the basis for a monte carlo study to look at power. I have a continuous outcome repeatedly measured 40 times on 80 people. I have two binary covariates. One which groups people into two groups of 40, and the other that designates stimulus form A or B, each repeated 20 times within person. I have:  Montecarlo: names are TE NP ageGrp; nobservations = 3200; cutpoints NP(1) ageGrp(1); ncsizes = 1; csizes = 80 (40); seed = 58459; nreps = 500; between = ageGrp; within = NP; ANALYSIS: TYPE = TWOLEVEL RANDOM; model population: %within% NP*1; TE on NP*1; TE*1; %between% ageGrp*1; TE on ageGrp*1; [TE*2]; TE*.5;  But I have a few questions/issues. I would like to get the repeated NP factor on both levels, but CUTPOINTS seems to work only for variables on a single level. I would also like to get the crosslevel interaction term for the two predictors, but am not sure how to get such values generated. 


If you want NP on both levels, do not put it on the WITHIN statement. Crosslevel interactions are obtained using a random slope model. See Example 9.2 and mcex9.2.inp for the Monte Carlo counterpart of Example 9.2. 


But, as I say, the cutpoint will not work then. *** ERROR in MONTECARLO command Cutpoints are currently only supported for BETWEEN or WITHIN variables. Cutpoints for variable NP were specified.  While the interaction is crosslevel as I specified it, I ideally want NP on both levels, so the WP interaction would be manifest. I guess the NP*ageGrp interaction would be a latent BPlevel NP with manifest BPlevel ageGrp. Does this require XWITH? It seemed that XWITH only worked with random slope, and was not accepted syntax for random interceptonly. Is this correct? Perhaps there is a better way to simulate a random intercept only model with two binary factors, one of which on the BP level. 


See Slide 39 of the Topic 7 course handout to see how the random slope model results in a crosslevel interaction. You do not use XWITH. NP does not need to be on both the within and between parts of the MODEL command. 

Vlad posted on Wednesday, February 02, 2011  12:16 pm



Hello, I have question regarding to mplus output. Here is the partial code of mplus. cluster=country; nominal=y; within=x; between=; analysis: type=twolevel; model: %within% y on z x; z on x; %between% savedata: file is J:\mplusm\work.txt; save is fscores; format is free; Since y is nominal with 4 categories and z is continuous,thus, I have 4 continuous intercepts(3 of them belong to y and 1 to z). When I open the saved output, intercepts of y do not vary across clusters (country). Why do these intercepts constant across countries? Regards, V 


Make sure that you estimate variances for the 4 intercepts on the Between level. 


My question refers to a path on level2 (random intercept) which I explored within a median split (2 groups  like multi group). My model: I do have a twolevel model with a random intercept and slope. Level1 = consumers; Level2 = Brands. The random intercept path was not significant with a high standard error. Then I splitted the sample according a variable "consumer identity" which is a variable actually on level1. The random intercept path becomes significant and is theoretically sound. Implementing this, I run the model with two different samples. My questions are: (1)Can I use a level1 variable (distinct for each consumer on level 1) to split the sample for a path on level2? (2)Does this refer to a third level but only having two groups on the third level via median split? Thanks for your help. 


1. You need to use a level 2 variable to split the sample if you want to maintain independence of observations. Using a level 1 variable will violate that. 2. No. 


Hello, I have 2 questions: 1. I'm conducting a twolevel SEM with one factor (w/4 indicators) regressed onto a second factor (w/7 indicators) at the within level. I am estimating random intercepts for all 11 indicators using a single factor at the between level. I have included one covariate at the between level. 10/11 of the random intercepts are positive and significant, however 1/11 of the random intercepts is negative and significant. Can I interpret these intercepts as occurring due to the betweenlevel covariate? For example, Hox (1995) wrote "if B01 is positive and significant, we conclude that school career outcome in large schools is higher than in small schools" B0j = B00 + B01*Zj + u0j, where B01 is the slope of the random intercept and Zj is school size (covariate). 2. If I do not include a covariate at the between level, can I interpret these as simply group level effects (as in oneway ANOVA)? Thanks so much! 


1. I assume that when you talk about random intercepts being positive or negative, you are really talking about the betweenlevel residual variances for the random intercept indicators of the betweenlevel factor. You should check if you get a negative random intercept variance without the betweenlevel covariate. Note also that these variances are typically small due to higher betweenlevel correlations (higher reliability). 2. The betweenlevel intercepts are clusterlevel effects. You are doing something in the spirit of random effects ANOVA, but with a factor structure. 


Dr. Muthen, I also read your 1994 paper (Multilevel Covariance Structure Analysis). For clarity, the random intercepts are the residual variances at the between level? Between Matrix = (Lambda)*(PsiB)*(Lambda') + ThetaB, where Lambda is the vector of factor loadings, PsiB describes the magnitude of the nonindependence, and ThetaB represents the grouplevel residual variance. How then do I interpret the factor loadings (Lambda) for the indicators at the between level? If you know of any applied papers that conduct MLSEM with random intercepts, please let me know. With gratitude, Christine 


No, the random intercepts are the variables that you apply your Between Matrix expression to  they are the factor indicators on Between. Doesn't matter that they are latent variables. Factor loadings are interpreted in line with regular factor analysis, but applied to the random intercepts  i.e. the betweenlevel variation of your variables. We discuss betweenlevel FA in our Topic 7 video and handout. There are papers listed under Multilevel SEM in our Paper's section on the web site. 

nick depp posted on Wednesday, November 09, 2011  11:33 pm



In the XYcoordinate plane, line L and line K intersect at the point (4,3). Is the product of their slopes negative? 1) The product of the x intercepts of line L and K is positive. 2) The product of the yintercepts of line L and k is negative. 


What is your Mplus MODEL command? 


Hello, i do have a few questions beeing a beginner with mplus. In my multilevel model for my master theses, i'd like to calculate unstandardized coefficients in form of a randominterceptmodel with fixed effects of the level1 variables (the individuals). The parameters should be estimated with the restrictedmaximumlikelihoodmethod. In addition the asymptotic standarderrors are to be used. I already used the grandmean centering option for all independent variables. Also the explained variances for each level shell always be calculated in relation to the nullmodel. Because I haven't used mplus before, i wonder how the input should look like for the level1 and level2 model. I already tried to find information about it, but didn't really find much. I hope i also posted this in the correct section. 


Hello again, here some additional information: The dependent variable (perception of public bads, ordinal scaled) as well as the independent variables on level1 are from a survey about selfreported delinquency done in several schools in a german city. The level2 variables are partly metric as well as some factorscores are used, for ex. a factorscore for problematic social structure, which combines average income, percentage of foreigners and percentage of singleparent households. The level2 data used are official data from the statistics bureau of the town where the survey was done. 


Mplus uses fullinformation maximum likelihood. REML is not available. See Examples 9.1 and 9.2 in the user's guide and the Topic 7 course handout on the website. 


Hello, I'm trying to fit a random intercept model with all variables modelled at the within and between level. usevariable = Lsati TB TC Risko TBxR; cluster = team; analysis: type = twolevel; model: %within% Lsati on TB TC Risko TBxR; %between% Lsati on TB TC Risko TBxR; In the output the betweenlevel coefficients and Rsquare tend to be large (some standardised coefficients are > 2.0 and Rsquare as large as .98), but all nonsignificant. Is this statistically sound? Can you recommend a citation to read up on this particular issue? Thank you 


Please send the output and your license number to support@statmodel.com. 

Paola posted on Wednesday, January 22, 2014  8:22 am



Hello, I would like to know if in version 7.11 is possible to use auxiliary variables (that I know are predictive of missing data and are not part of the model) with random intercept models TYPE=TWOLEVEL Thank you 


If you mean the AUXILIARY missing option, no. If not, which AUXILIARY option do you refer to. 

jan mod posted on Thursday, January 29, 2015  3:42 am



Does this syntax give me a random intercept model (three levels)? Thanks. VARIABLE: NAMES = a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a100; USEVARIABLES = a6 a14 a15 a18 a20 a19 a8 a9 a21 a4 a13 a17 a10 a100; CLUSTER = a2 a3; WITHIN = a19; BETWEEN = (a3) a6 a8 a9 a4 a13 a17 a10 a21 a100 (a2) a14 a15 a18; ANALYSIS: TYPE = THREELEVEL RANDOM; MODEL: %WITHIN% a20 on a19; %BETWEEN a3% a20 on a6 a8 a9 a21 a4 a13 a17 a10 a100; %BETWEEN a2% a20 on a14 a15 a18; 


Yes. 

Okyoung, JI posted on Wednesday, February 03, 2016  12:26 am



hi Dr.Muthens i am analyzing multilevel data. i wrote the code like this: title: this is twolevel random analysis with day and person level variables(m_WDQ, m_SED, data: file is small model2.txt ; variable: names = x m y1 y2 w id ; usevariables = x m y1 y2 w id ; within = x m y1 y2 ; between = w ; cluster = id ; analysis: type=twolevel random ; model: %within% s1 m on x ; s2 y1 on m ; s3 y2 on m ; s4 y1 on x ; s5 y2 on x ; %between% s2 s3 on w ; output: tech1 tech8 ; then warnings appeared.. *** WARNING in MODEL command Variable on the lefthand side of an ON statement in a  statement is a WITHIN variable. The intercept for this variable is not random. Variable: M *** WARNING in MODEL command Variable on the lefthand side of an ON statement in a  statement is a WITHIN variable. The intercept for this variable is not random. Variable: Y1 *** WARNING in MODEL command Variable on the lefthand side of an ON statement in a  statement is a WITHIN variable. The intercept for this variable is not random. Variable: Y2 i exactly command a type=twolevel random.. why are not those variables intercept random? 


You have a contradiction if you think that M, Y1, Y2 are within variables  which means that they don't vary on Between  and having them have a random slope which does vary on Between. 

QianLi Xue posted on Tuesday, February 14, 2017  11:47 am



I'm using the following code to fit a parallel growth curve model, and want to save random slopes and intercepts into a file. In the saved file, multiple columns are appended to the data set. I'm assuming some of them are estimates of random effects. So my questions are: (1) the random effects are individual intercept and slope, not deviation from population mean intercept and slope, right? (2) Besides the random effects estimates, what else is also included in the saved file? standard errors? Thank you! ******************************* ANALYSIS: TYPE = RANDOM; MODEL: iwbc swbc  wbc1wbc7 AT R1DATER7DATE; ilymph slymph  lymph1lymph3 AT R1DATER3DATE; iwbc swbc PWITH ilymph slymph; iwbc WITH slymph; ilymph WITH swbc; SAVEDATA: FILE IS "h:\grant\sean\Flow\random.sav"; SAVE = FSCORES; FORMAT 26F15.3; 


To answer this we need to see your output and savedata file  send to Support along with your license number. Also, we ask that postings fit into a single window. 

Nadine Meier posted on Tuesday, November 21, 2017  11:01 pm



Hello I have to do a interceptsandslopesasoutcomesmodell for my master thesis and I don't know if my inputs's right. And my supervisor doesn't want to help me. My "within" Variables are control variables and they are dummy variables. Is it right to put every time "Betalj " at the "model within" section? Or do I have to put it just before the first "within variable"? usevar = L oar_gE Zei Mitte Ende; cluster = rater_nr; within = L Mitte Ende; between = Zei; analysis: type = twolevel random; model: %within% Betalj  oar_gE on L; Betalj  oar_gE on Mitte; Betalj  oar_gE on Ende; %between% oar_gE on Zei; Betalj on Zei; oar_gE with Betalj; output: sampstat; 

Nadine Meier posted on Wednesday, November 22, 2017  11:33 am



Thanks in advance!! 


Study Topic 7 of our Short Course videos and handouts on our website. 

Nadine Meier posted on Thursday, November 23, 2017  4:44 am



Thank you!!!! 


I still have one question left. I have to put all variables in one model. I have 4 dependet variables (oar_gE oar_sE j_gE j_sE). Now I'm struggling with the "within" part. I have three betas as control variables. I would like to combine these with all the dependet variables and I can't find any other syntax with a similar content,sorry. I would propose to do it like this: analysis: type = twolevel random; model: %within% beta1  oar_gE oar_sE j_gE j_sE on L; beta2  oar_gE oar_sE j_gE j_sE on Mitte; beta3  oar_gE oar_sE j_gE j_sE on Ende; does this look right to you? Thank you. 


Sorry my fault, this doesn't work, a thinking error. It works now! 

Seth Frndak posted on Saturday, September 19, 2020  11:36 am



I tested a random intercept for my MLM and found that it was not supported. Therefore I used the following: WITHIN = x; BETWEEN = w; CLUSTER = CODSEG; ANALYSIS: TYPE = TWOLEVEL; MODEL: %WITHIN% y ON x; %BETWEEN% y@0; y ON w; In this case, is this model no longer an MLM? Is it truly just a GLM? 


Your Between statement says that the residual variance of Y (where Y is the random intercept) is zero. But Y still varies as a function of the betweenlevel w so Y does have betweenlevel variation. It's just that you are saying that w explains all of Y's betweenlevel variation (Rsquare=1). So Y is still a multilevel model. 

Seth Frndak posted on Saturday, September 19, 2020  12:15 pm



Ah! Yes thank you for your quick response! This makes sense. Is there a way to test the hierarchical structure of my data inside Mplus? Do I just test the ICCs? ICC = variance between/(variance between + variance within) I saw a post by Linda Muthen about design effect, but it was from 1999: 1 + (average cluster size  1)*intraclass correlation I haven't seen much about design effect. Has there been an advancement in this since? 


You would consider the betweenlevel variance that is in the nominator of the icc. Although testing variances is a chapter in itself. No, design effects appear mostly in the domain of survey sampling. That formula is just a rough guideline as a reminder that the cluster size is also important. You can also simply run with and without Type=Complex to see how big the differences are in the SEs. 


I am interested in estimating a model with a fixed effect at level 1, but still allows for crosslevel interactions. Would this syntax be correct: ANALYSIS: TYPE = TWOLEVEL; MODEL: %WITHIN% s y ON x; %BETWEEN% s@0; y ON w; s on w; For specifying these in level 1 and 2 equations, I'd like to double check to make sure I have the error terms correct in the following: Level 1: Y = B0j + B1j(Xij) + eij Level 2: B0j = U00 + U01(Wj) + u0j B1j = U10 + U11(Wj) 


Correct. ( Just put subscripts ij on Y.) 

Back to top 