Message/Author 

Susan Scott posted on Wednesday, November 22, 2006  10:39 am



I have the feeling I may be missing something very obvious, but when I add the following statement to my model DEFINE: sf36 = (pcs_ob + mcs_ob)/2; with sf36 used in the following model statement: MODEL: HRQL BY eqsum eq5dw10 hu3m eqtherm sf36; I get the error message: ** FATAL ERROR THE SAMPLE COVARIANCE MATRIX COULD NOT BE INVERTED. THIS CAN OCCUR IF A VARIABLE HAS NO VARIATION, OR IF TWO VARIABLES ARE PERFECTLY CORRELATED, OR IF THE NUMBER OF OBSERVATIONS IS NOT GREATER THAN THE NUMBER OF VARIABLES. CHECK YOUR DATA. THIS PROBLEM IS DUE TO: VARIABLE : SF36 I am able to run the model with each of these variables individually, ie. pcs_ob and mcs_ob instead of sf_36. Also, I tried defining sf36 as sf36=pcs_ob, and I still get this message. So I am guessing the problem is with my definition statement. Thank you, Susan 


Please send your input, data, output, and license number to support@statmodel.com. It is not obvious what the problem is without further information. 

David Bard posted on Wednesday, November 22, 2006  9:44 pm



It's not obvious to me why, but adding a define command to my syntax resulted in loss of observations for a model that did not even contain the variables used in the define command. The define syntax was used for a previous model and was simply left in this new model after a cut and paste. It's not a big deal, I will simply exclude define commands not needed for a given model, but can you explain why this happens? tx, db. If it helps, here's the define syntax: DEFINE: citpreg = citynum*pregnant; twkhighc = twkhigh; if twkhigh > 5 then twkhighc = 5; twkamhdc = twkamhd2; if twkamhd2 > 5 then twkamhdc = 5; formrbc = formrb; 


I would need more information to answer this question. Please send your input, data, output, and license number to support@statmodel.com. 


I want to add a random variable to an existing variable. I do not plan to do this repeatedly like in a Monte Carlo study. I just need to use a command like DEFINE y=x+e, where: y  new variable x  old variable e  random variable from the normal distribution with zero mean and a standard error I can choose. Can/(how do) I do this in Mplus? Thank you. 


If e is latent, you don't need Define but can do it in the Model command as: e BY; If e is observed, Mplus does not currently offer this capability. 


I wish to create MD_A from G12A and G15A where G12A tests presence of a condition (yes=1, no=5) while G15A scores severity scale' at 3 levels if checked 'yes' on G12A but assigns 'missing' if checked 'no'. I wish to combine G12A and G15A in a new 4level scale MD_A where 0 indicates absence of condition. Below is the partial syntax and error I am getting. USEVARIABLES ARE G18A G18B G18C G18D G18E G18F G18G G18H G18I G18J MD_A MD_B MD_C MD_D MD_E MD_F MD_G MD_H MD_I ; CATEGORICAL ARE G18A G18B G18C G18D G18E G18F G18G G18H G18I G18J MD_A MD_B MD_C MD_D MD_E MD_F MD_G MD_H MD_I ; MISSING=. ; DEFINE: IF (G12A == 1) THEN MD_A == 0 ; IF (G12A == 5 AND G15A == 1) THEN MD_A == 1 ; IF (G12A == 5 AND G15A == 2) THEN MD_A == 2 ; IF (G12A == 5 AND G15A >= 3) THEN MD_A == 3 ; IF (G12B == 1) THEN MD_B == 0 ; IF (G12B == 5 AND G15B == 1) THEN MD_B == 1 ; IF (G12B == 5 AND G15B == 2) THEN MD_B == 2 ; IF (G12B == 5 AND G15B >= 3) THEN MD_B == 3 ; .... ANALYSIS: TYPE = EFA 1 4; PLOT: TYPE IS PLOT3 ; *** ERROR Variable names must begin with an alphabet character: EQ 


See the DEFINE option of the user's guide. You can't use == on both the right and lefthand sides of THEN. On the righthand side use =. 


I spotted an error in my syntax above and corrected it to now read: IF (G12A == 5) THEN MD_A == 0 ; IF (G12A == 1 AND G15A == 1) THEN MD_A == 1 ; IF (G12A == 1 AND G15A == 2) THEN MD_A == 2 ; IF (G12A == 1 AND G15A >= 3) THEN MD_A == 3 ; But I am still getting the same error (below) about variable names which I could not figure out : *** ERROR Variable names must begin with an alphabet character: EQ Thanks for your help. 


On the righthand side use = not ==. 


Why does Mplus use a degree of freedom to compute a new variable? How do I ensure that the added degree(s) of freedom does not influence my measures of model fit? Thanks for your help. 


I don't understand your question. Please send outputs that illustrate what you are saying along with your license number to support@statmodel.com. 

Kerry Lee posted on Monday, December 06, 2010  3:15 am



Dear Dr. Muthen, Is it necessary to list both the original variables and new variables created using DEFINE in USEVARIABLES? I thought this was the case after reading the User's Guide. However, when I did this, both original and new were included in a CFA model even though only the new variables were specified in MODEL. On a related matter, I ran the same analysis using either the original and new variables (original/x to bring the scale back to 1  10). The raw bivariate correlations naturally remain the same, but the standardized CFA factor loadings and correlations are different. Are such differences to be expected? The difference in time needed to run the two analyses was astonishing: 37 min versus 56 sec (scaled). Sincerely, Kerry. 


Every variable specified on the USEVARIABLES list is included in the model to be estimated. New variables created using DEFINE must be placed on the USEVARIABLES list if they are used in the MODEL command. If any original variables are used in the MODEL command, the new variables created in DEFINE must follow them on the USEVARIABLES list. Large variances make model convergence more difficult so this could increase the time. I would have to see the two outputs and your license number at support@statmodel.com to comment on the standardized coefficients. 

Back to top 