Basic SEM model Constraints PreviousNext
Mplus Discussion > Structural Equation Modeling >
Message/Author
 Joseph Cote posted on Friday, June 08, 2012 - 6:11 pm
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.
 Bengt O. Muthen posted on Friday, June 08, 2012 - 8:32 pm
If you have say

f by y1-y3;
y1-y3 (resvar1-resvar3);

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 y1-y3 (resvar1-resvar3) for SEM?
 Bengt O. Muthen posted on Wednesday, June 13, 2012 - 2:25 pm
See the Mplus V6 UG, pp. 615-617. See also UG ex 5.20.
 Aleksandra Luksyte posted on Monday, November 05, 2012 - 6:11 pm
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 left-hand side of a MODEL CONSTRAINT statement.' Here is my code:
MODEL:
CREAT BY creat1-creat9;
INCIV BY inciv1-inciv7;
COMMUN BY commun1-commun5;
commun1-commun5 (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!
 Linda K. Muthen posted on Tuesday, November 06, 2012 - 5:53 am
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;
 Aleksandra Luksyte posted on Tuesday, November 06, 2012 - 5:05 pm
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 creat1-creat9;
INCIV BY inciv1-inciv7;
COMMUN BY commun1@0.958 commun2@0.999
commun3@0.581 commun4@0.950 commun5@0.974;
commun1-commun5 (resvar1-resvar5);
resvar1@0.410;
resvar2@0.325;
resvar3@1.120;
resvar4@0.297;
resvar5@0.289;
CREAT@1;
INCIV@1;
COMMUN@1;
 Linda K. Muthen posted on Tuesday, November 06, 2012 - 5:32 pm
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 creat1-creat9;
INCIV BY inciv1-inciv7;
COMMUN BY commun1@0.958 commun2@0.999
commun3@0.581 commun4@0.950 commun5@0.974;
commun1-commun5;
commun1@0.410
etc.
 Aleksandra Luksyte posted on Tuesday, November 06, 2012 - 5:45 pm
Linda, it worked! Thank you so much for your prompt help!
 Frauke Günther posted on Friday, January 11, 2013 - 5:55 am
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 x1-x21;
USEVARIABLES ARE x1-x14 x19-x21;
CATEGORICAL ARE x1-x3;
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 x4-x14 x19-x21;

MODEL: ! Specification of the measurement model
F1 BY x1* x2@1 x3;
F2 BY x5-x10;
F3 BY x11* x12@1 x13 x14;
F4 BY x19-x21;

! 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;
 Linda K. Muthen posted on Friday, January 11, 2013 - 10:55 am
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.
 Frauke Günther posted on Monday, January 14, 2013 - 3:48 am
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.
 Linda K. Muthen posted on Monday, January 14, 2013 - 10:33 am
That the variables have entries in beta is not meaningful. It is an Mplus convention with no statistical ramifications.
 Frauke Günther posted on Monday, January 14, 2013 - 11:36 pm
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!
 Linda K. Muthen posted on Monday, March 04, 2013 - 9:46 am
R-square is one minus the standardized residual variance.
 Peter Hilpert posted on Friday, October 11, 2013 - 1:19 am
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 CHI-SQUARE 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
 Linda K. Muthen posted on Friday, October 11, 2013 - 10:34 am
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.
 Peter Hilpert posted on Wednesday, October 16, 2013 - 7:59 am
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
 Linda K. Muthen posted on Wednesday, October 16, 2013 - 12:55 pm
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.
 Trang Q. Nguyen posted on Monday, December 08, 2014 - 9:00 pm
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!
 Linda K. Muthen posted on Tuesday, December 09, 2014 - 10:13 am
1. Yes, this is possible. See MODEL CONSTRAINT and the CONSTRAINT option of the VARIABLE command.

2. No, this is not possible.
 Trang Q. Nguyen posted on Wednesday, December 10, 2014 - 12:34 pm
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!
 Trang Q. Nguyen posted on Wednesday, December 10, 2014 - 1:16 pm
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.
 Bengt O. Muthen posted on Wednesday, December 10, 2014 - 2:26 pm
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 model-estimated mean parameters.
 Trang Q. Nguyen posted on Wednesday, December 10, 2014 - 3:45 pm
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!
 Bengt O. Muthen posted on Wednesday, December 10, 2014 - 6:35 pm
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.
 Trang Q. Nguyen posted on Thursday, December 11, 2014 - 11:35 am
Thank you so much! That is a very interesting example of a constraint.
 Trang Q. Nguyen posted on Friday, December 12, 2014 - 6:36 am
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!
 Bengt O. Muthen posted on Friday, December 12, 2014 - 6:13 pm
I think so.
 Trang Q. Nguyen posted on Friday, December 12, 2014 - 7:01 pm
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 left-hand 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);
 Bengt O. Muthen posted on Tuesday, January 24, 2017 - 5:45 pm
Please send your full output to Support along with your license number.
 Jim Hamilton posted on Thursday, June 14, 2018 - 12:58 pm
I am testing a model in which I need to assess the interactive effects of a latent slope and an observed variable. I am testing the hypothesis that a different interactive effect is mediated by the latent slope variable. Because I need the XWITH command to compute the first interaction I can't use model indirect, so I am using the Model Contraint approach to mediation instead. I used the handy syntax for the mplus adaptation of Process Model 8 (http://offbeat.group.shef.ac.uk/FIO/model8latent.htm)

I got my model to run, but my output doesn't look any different than my output with all the model constraint syntax. How/where do I obtain the indirect effects? The language generated a .g5 file but I have no way to open it.

PLOT:
TYPE = plot2;

OUTPUT:
STAND CINT;
 Bengt O. Muthen posted on Thursday, June 14, 2018 - 4:55 pm
The output shows you the "IND" and "DIR" estimates that Model Constraint produces when you use those scripts - and you can also look at the plots.

If this doesn't help, send your output to Support along with your license number.
Back to top
Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: