BookmarkSubscribeRSS Feed
BlueNose
Quartz | Level 8

Hello all,

 

I have a sample containing data on 400 school students.

 

For each student I have 3 dependent variables: Y1, Y2, Y3

 

In addition, for each student I have several independent variables: Age, Gender, ....

 

The students come from classes. Some students share the same class, so for each student I have the class as another independent variable.

 

In a different file, I have teacher data, such as teacher age, teacher gender,...

 

I need to try and find out which variables relate, or affect Y1, Y2 and Y3.

 

Since I have students from the same class, I thought that class should be a random effect and I will need PROC Mixed for the analysis (Y1 Y2 and Y3 are all continuous).

 

I am not sure what to do with the teacher data. Teacher's age might affect the dependent variables, same is gender. Can I simply add these variables to the model as fixed effects, while class is random effect ? Obviously, same class means same teacher...

 

Is this code reasonable ?

 

proc mixed data=school;
      class Gender_S Gender_T;
      model Y1 = Gender_S Gender_T Age_S Age_T;
random class; run;

 

And one more thing if I may. Is there a way to analyze all dependent variables together, like in MANOVA or MANCOVA, but only with mixed models ?

 

Thank you in advance !

2 REPLIES 2
Daniel_Paul
Obsidian | Level 7

Hey,

 

for a random intercept model you code will look like 

 

proc mixed data=school;
      class Gender_S Gender_T ;
      model Y1 = Gender_S Gender_T Age_S Age_T;
      random int / sub=class;
 run;

However, usually class should also be a class variable, so you should add this to the class statement. In addition, you should look at the type option for the random statement. 

 

Bye,

Daniel

 

 

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Your code might work correctly, or it might not. Among other things, whether your code is correct depends upon the data structure (what observations exist for what levels of what factors) in addition to how the data set is sorted (because the class variable is not in the CLASS statement) plus how you have coded the levels for your random effects factors.

 

How many classes do you have? What does the tabulation of age x gender look like for classes: in other words, how many classes do you have for each combination of age (how many levels?) and gender (2 levels presumably) and for the marginal totals for age and gender?

 

At the class level, notice that you have a two-way factorial (either without or with interaction) of age and gender. There is intuitive value in recognizing this ANOVA for class-level data as you set up a mixed model with students nested within classes (which is likely a form of split-plot design). If you do not have adequate replication (i.e., multiple classes) of teacher age and gender, then your ability to model the effects of teacher age and gender on student outcomes is limited or even not possible.

 

The MIXED procedure is able to do multivariate analysis using Kronecker products as discussed here. However, I recommend starting simply, with univariate analyses and make sure those work correctly before attempting multivariate analysis.

 

SAS® for Mixed Models, Second Edition is an excellent resource that addresses many aspects of your modeling challenge.

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 2 replies
  • 1636 views
  • 0 likes
  • 3 in conversation