Dears,
I am analysing data from a Cluster-randomized control trial conducted in different schools in different cities, thus with three RANDOM FACTORS. Students are assigned to to either a treatment or a control group (CONDITION), and the goal is to evaluate the effect of the treatment on two DVs.
So far I have analysed the data with PROC MIXED (syntax included), separately for each DV. However, I am now required to consider the two DVs as indicators of a Latent variable, and I am thus used PROC CALIS to test a Latent Change Model.
The syntax of both the PROC MIXED and the PROC CALIS are attached. However, my PROC CALIS syntax, at present, is not taking into consideration the random factors and it is also not considering other individual difference variables, such as SEX and Age, which are considered in PROC MIXED. I believe I may have to test a Multilevel Structural Equation Model, but this is stretching my SAS programming skills, and I am thus here I am. Any suggestion on how to add the random factors (and ideally also age and sex in a manner equivalent to what is now in PROC MIXED) to the PROC CALIS would be much appreciated.
/*
NOTE
data long (PROC MIXED)is in long format; variable TIME (time1 and time2) represents the repeated-measure factor
data wide (for PROC CALIS) is in wide format.
DV1_1 and DV2_1 are measurement at time1
DV1_2 and DV2_2 are measurement at time2
*/
proc mixed data=long;
class id Condition school class place sex time;
model DV1= condition|time|sex|age ;
Random intercept /subject=class(school);
Random intercept /subject=school(place);
Random intercept /subject=place;
proc mixed data=long;
class id Condition school class place sex time;
model DV2= condition|time|sex|age ;
Random intercept /subject=class(school);
Random intercept /subject=school(place);
Random intercept /subject=place;
proc calis data=wide;
lineqs
DV1_1 = 1 fLatent1 + e1,
DV2_1 = 1 fLatent1 + e2,
DV1_2 = 1 fLatent2 + e3,
DV2_2 = 1 fLatent2 + e4,
fLatent2 = 1 fLatent1 + 1 fdelta + e5,
fdelta = a6 Condition + e6;
cov
e1 e3 =DV1corr,
e2 e4 =DV2corr;
std
fLatent1 = eFL1,
e1-e4 = evar1-evar4,
e5 = 0,
e6 = evar6;
run;
Hello,
SAS has a course entitled :
Structural Equation Modeling Using SAS®
The overview page says this :
This course does not address models containing categorical endogenous variables or multilevel SEM, as these methods are not supported in the CALIS procedure.
I think this statement is still true.
Maybe @CatTruxillo can confirm?
BR, Koen
Consider that the two dependent variables are correlated measures on each subject, i.e. two manifestations of a latent variable. PROC MIXED supports Kronecker product covariance structures to handle this. See this paper by Tao, Kiernan and Gibbs
https://support.sas.com/resources/papers/proceedings15/SAS1919-2015.pdf
To make this work you will need to move from the long form of your data to an "extra-long" format, adding a new variable (call it new_DV that takes on a value of 1 when the response variable is DV1 and 2 when the response variable is DV2. In the extra-long format, each record will have a unique combination of id, condition, school, class, place, sex, time and new_DV
Code for the analysis could look like this:
proc mixed data=long;
class id Condition school class place sex time new_dv;
model response = new_DV|condition|time|sex|age/solution ;
Random intercept /subject=class(school);
Random intercept /subject=school(place);
Random intercept /subject=place;
Repeated new_DV time/type=un@un subject=id r;
This assumes that ID is unique across all schools, classes and places. If not, you'll have to nest ID in the subject= option for the REPEATED statement.
I hope this is along the lines of what you are looking for. I fear that fitting a five-way interaction and all lower level interactions might be a bit dicey, unless you have thousands of records.
SteveDenham
Dear Steve,
thanks for this suggestion. I have about 700 records, so not ideal for this, but the model does give me the pattern that is expected, with a significant interaction between condition, time - even though the 3-way interaction with the "latent" variable (new_dv) is also significant, since the two-way interaction condition*time is stronger for one level of new_dv. I will try and present these analysis.
Thank you, as always.
Eman
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.