Message/Author 


How can you constrain basic SEM parameters is MPlus? I am trying to constrain the variance of TD(31,31)> 0 (the estimated error variance is negative). But I can't find information about the notation used in MPLUS for various parameters. In EQS I would use the command /CON (E31,E31)>0; (for V31=*F1+E31;). I assume the command would be something like the following with "TD31" replaced with the appropriate name for the parameter. MODEL CONSTRAINT: NEW(TD31); TD31>0; I tried f11 by CInspir2* CInspir3 CInspir1 (ineq); f11@1; Model Constraint: ineq<1; This fixed the negative error variance problem, but caused all the loadings for f11 to be equal. It would also be helpful to know how to extend this to other parameters (lambda, beta, psi, phi, etc). I have read the Model Constraints section of the manual and search the discussion postings and web  sorry, I am still at a loss of how to do this. Thank you for your help. 


If you have say f by y1y3; y1y3 (resvar1resvar3); you can constrain these residual variances to be > 0 by: Model Constraint: resvar1>0; resvar2>0; resvar3>0; 

Joseph Cote posted on Wednesday, June 13, 2012  2:05 pm



Bengt, Thank you for the help. Just for clarification, where can I read more about commands like y1y3 (resvar1resvar3) for SEM? 


See the Mplus V6 UG, pp. 615617. See also UG ex 5.20. 


Hello, how can I constrain factor loadings and error variances to specific values? I tried this syntax, but it gives me error messages "A parameter label or the constant 0 must appear on the lefthand side of a MODEL CONSTRAINT statement.' Here is my code: MODEL: CREAT BY creat1creat9; INCIV BY inciv1inciv7; COMMUN BY commun1commun5; commun1commun5 (resvar1 resvar5); Model Constraint: 0.958 = commun1; 0.999 = commun2; 0.581 = commun3; 0.950 = commun4; 0.974 = commun5; 0.410 = resvar1; 0.325 = resvar2; 1.120 = resvar3; 0.297 = resvar4; 0.289 = resvar5; Thank you for your help! 


You do not need to use MODEL CONSTRAINT to fix parameters to particular values. You can do this in the MODEL command, for example, COMMUN BY commun1*@0.958 commun2@0.999 commun3@0.581 commun4@0.950 commun5@0.974; commun@1; 


Thank you, Linda, for your prompt reply! How can I constraint error variances? I tried this syntax and I get the error message that "Unknown variables: RESVAR1 in line: RESVAR1@0.410." MODEL: CREAT BY creat1creat9; INCIV BY inciv1inciv7; COMMUN BY commun1@0.958 commun2@0.999 commun3@0.581 commun4@0.950 commun5@0.974; commun1commun5 (resvar1resvar5); resvar1@0.410; resvar2@0.325; resvar3@1.120; resvar4@0.297; resvar5@0.289; CREAT@1; INCIV@1; COMMUN@1; 


You can't use variable names in MODEL CONSTRAINT and you can't use labels to refer to parameters in the MODEL command. MODEL: CREAT BY creat1creat9; INCIV BY inciv1inciv7; COMMUN BY commun1@0.958 commun2@0.999 commun3@0.581 commun4@0.950 commun5@0.974; commun1commun5; commun1@0.410 etc. 


Linda, it worked! Thank you so much for your prompt help! 


Dear Drs. Muthen, I am trying to estimate an interaction/mediation effect using the model constraint option. Is it possible to constrain the regression coefficients obtained from the on statement? Trying the following, I get the fatal error THIS PARAMETER RESTRICTION MODEL IS NOT AVAILABLE. I would be very happy if you could have a look on my code and perhaps tell me where the error lies. Thank you very much in advance. VARIABLE: NAMES ARE x1x21; USEVARIABLES ARE x1x14 x19x21; CATEGORICAL ARE x1x3; MISSING =.; CONSTRAINT ARE fto1 fto2; DEFINE: ! Definition of dummy variables x15_1=0; IF (x15==2) THEN x15_1 = 1; x15_2=0; IF (x15==3) THEN x15_2 = 1; STANDARDIZE x4x14 x19x21; MODEL: ! Specification of the measurement model F1 BY x1* x2@1 x3; F2 BY x5x10; F3 BY x11* x12@1 x13 x14; F4 BY x19x21; ! Specification of the structural model F4 on F1 (b1) F2 (b2) F3 (b3); MODEL CONSTRAINT: NEW(int15*0 int15_1*1 int15_2*1); b1 = int15 + int15_1*x15_1 + int15_2*x15_2; 


I think what you want is something like: int  f1 XWITH f2; f4 ON f1 f2 int; I don't understand your specification in MODEL CONSTRAINT. 


Thank you very much for your answer. I tried that. Actually, I want to estimate an interaction between a categorical variable with three categories and a latent construct. Thus, I think I have to specify two interaction terms using dummy variables: int_1  F1 XWITH x_1; !x_1 representing x==2; int_2  F1 XWITH x_2; !x_2 representing x==3; F4 on F1 F2 F3 x_1 x_2 int_1 int_2; The output of this model (parameter specification) indicates that the observed variables x_1 and x_2 are treated as latent variables because both variables have corresponding entries in the beta matrix and for both dimensions in the lambda matrix. Is this correct or just a notational problem? Thank you again very much for your support. 


That the variables have entries in beta is not meaningful. It is an Mplus convention with no statistical ramifications. 


Thank you very much for your support! 

J.D. Smith posted on Monday, March 04, 2013  9:34 am



I am trying to conduct a Wald test and I am interested in the significance of the change in R^2. I know you can specify a "new" parameter in the Model Constraint command and define it for comparison but I have been unable to find the correct syntax for the R^2 parameter? Any guidance would be appreciated. Thank you! 


Rsquare is one minus the standardized residual variance. 


Dear Drs. Muthen, I have an APIM (dyadic data) with two indipendent variables and two mediators and I want to test, whether mediation differs between genders. I try to restrict the indirect effects to be equal, but I am not sure how to do this. MODEL: ... MODEL INDIRECT: tmsm IND tconfm tanxim (p1); tmsm IND tconff tanxim; tmsm IND tconff tanxieF; tmsm IND tconfm tanxieF; tmsF IND tconff tanxieF (p2); tmsF IND tconfm tanxieF; tmsF IND tconfm tanxim; tmsF IND tconff tanxim; ! Now, the indirect effect p1 should be set equal with p2, but I am not sure how to do this with the model contraint command. MODEL CONSTRAINT: NEW (p1 p2); p1 = p2; But if I let this model run, I get the following output: THE DEGREES OF FREEDOM FOR THIS MODEL ARE NEGATIVE. THE MODEL IS NOT IDENTIFIED. NO CHISQUARE TEST IS AVAILABLE. CHECK YOUR MODEL. ... and the degrees of freedom are 1 instead of 1. What would be the correct way to put the two indirect effects to be equal? Thank you for your support 


You cannot use labels in MODEL INDIRECT. You would need to create the indirect effects in MODEL CONSTRAINT using labels from the MODEL command and test their equality in MODEL CONSTRAINT. 


Dear Linda, Thanks for your fast replay. I tried to do it but now I get another error message. In order to get the indirect effects, I made the following syntax: MODEL: ... MODEL INDIRECT: ... MODEL CONSTRAINT: NEW (p1 p2); p1 = (tmsm ON tcomnm)*(tcomnm ON tanxim); p2 = (tmsF ON tcomnf)*(tcomnf ON tanxieF); p1=p2; Even though I used the variables from the data set, I get the following error mesage: *** ERROR Unknown parameter label in MODEL CONSTRAINT: TMSM Hmm, what should I change (it is the correct name of the dependent variable)? Thanks and best regards 


Please read MODEL CONSTRAINT in the user's guide. The ON option is not part of it and parameter labels not variable names are used in MODEL CONSTRAINT. 


Hi, I have two questions: 1) Is it possible to use MODEL CONSTRAINT: NEW to specify quantities that are functions of some model parameters and variables in the data? For example, the model has parameters a and b, the data include variables x1 and x2, and I want to compute: c = mean(a*x1 + b*x2). 2) If the answer to (1) is yes, is it possible to use vector/matrix multiplication notation in specifying new quantities in MODEL CONSTRAINT? Some of the functions I am dealing with are a bit messy in regular algebraic notation. Thank you! 


1. Yes, this is possible. See MODEL CONSTRAINT and the CONSTRAINT option of the VARIABLE command. 2. No, this is not possible. 


Thank you. This is wonderful. May I just confirm that this is the correct input? VARIABLE: ... CONSTRAINT = x1 x2; MODEL: .... (a); .... (b); MODEL CONSTRAINT: NEW(q); q = mean(a*x1 + b*x2); Is that the correct way to specify a mean function? Thanks! 


PS: I tried the above, and with ML and MLR, I got: *** FATAL ERROR NEW PARAMETERS CAN NOT DEPENDENT ON THE CONSTRAINT VARIABLES. I tried WLSMV (I have a binary dependent variable), and got the same error. 


Sorry, the Model Constraint expression "mean" does not exist. But note that q = mean(a*x1+b*x2) = a*x1mean+b*x2mean so that you can simply use that latter form in Model Constraint. The means can be either sample means or modelestimated mean parameters. 


Thank you. Sorry, it was just a toy example. I need to average over the sample a complex function that cannot be reduced to simple sufficient statistics but requires the actual data. I am curious, in what cases can a variable listed in VARIABLE: CONSTRAINT be used in the right hand side of a statement in MODEL CONSTRAINT to define a new parameter? I am thinking to reduce information in a function of a data vector to a scalar we would need some function in the group of mean, sum, median, quantile, etc. The Mplus Users Guide mentions that variables listed in VARIABLE: CONSTRAINT can be used on the right hand side of statements in MODEL CONSTRAINT but none of the examples given are about this. Thanks! 


UG ex5.23 uses the pihat variable as Constraint=. Currently, you have to use the raw data variable itself  functions summarizing raw data like mean, sum, median, quantile are not available in Model Constraint. 


Thank you so much! That is a very interesting example of a constraint. 


Hi, I have another question. If I want a lot more precision than 3 decimal places, would it be OK to use MODEL CONSTRAINT to specify a new parameter that is 1000 times a model parameter? I know I could save results to get more decimal places, but would this trick work too? MODEL: y ON x (b); MODEL CONSTRAINT: NEW(big_b); big_b = b*1000; Thank you! 


I think so. 


Thank you! I tried, and it does not change anything else, so everything is good. 

Kathy Vu posted on Tuesday, January 24, 2017  3:20 pm



Hello Drs. Muthen, I am having an issue with the Model Constraint command. Similar to Aleksandra, I received the error message " A parameter label or the constant 0 must appear on the lefthand side of a MODEL CONSTRAINT statement. Problem with the following: HIMOD) = ". My code is in the below post. 

Kathy Vu posted on Tuesday, January 24, 2017  3:20 pm



ANALYSIS: TYPE = GENERAL; ESTIMATOR = ML; BOOTSTRAP = 10000; MODEL: [r3] (b0); r3 ON w2 (b1); r3 ON r2 (b2); r3 ON r1 (b3); r3 ON ac1 (cdash); [w2] (a0); w2 ON ac1 (a1); w2 ON e1 (a2); w2 ON ace1 (a3); w2 ON w1 (a4); MODEL CONSTRAINT: NEW(LOW_W MED_W HIGH_W IND_LOWW IND_MEDW IND_HIW TOT_LOWW TOT_MEDW TOT_HIW); LOW_W = 80.9569; MED_W = 92.2461; HIGH_W = 103.5353; IND_LOWW = a1*b1 + a3*b1*LOW_W; IND_MEDW = a1*b1 + a3*b1*MED_W; IND_HIW = a1*b1 + a3*b1*HIGH_W; TOT_LOWW = IND_LOWW + cdash; TOT_MEDW = IND_MEDW + cdash; TOT_HIW = IND_HIW + cdash; PLOT(LOMOD MEDMOD HIMOD); LOOP(XVAL,1,5,0.1); LOMOD = IND_LOWW*XVAL; MEDMOD = IND_MEDW*XVAL; HIMOD = IND_HIW*XVAL; PLOT: TYPE = plot2; OUTPUT: STAND CINT(bcbootstrap); 


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

Back to top 