Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Setting up a mixed model

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 07-18-2018 06:45 AM
(1858 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 16. Read more here about **why** you should contribute and **what is in it** for you!

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.