### Jan

#### 18

# Mixed Models Workshop – My notes in tweets

Filed Under statistics

Wednesday, I went to a workshop, Mixed Models for Professors. It was a combination of discussion of the mathematics of mixed models, using SAS Enterprise Guide and examples for teaching. Since I was too lazy to actually take notes, I just tweeted it. Three useful pieces of advice, even if you don’t like my notes:

- SAS offers classes for professors for free several times a year. I don’t know who you need to suck up to for an invitation. I was not on their mailing list and now I am.
- The class notes book they give you is a great deal. It’s also free.
- If you live in southern California, there is a GLIMMIX class in June at National University.

Interaction in a mixed model – if at least one of the effects is random, the interaction is random

Randomized complete block design – blocks are random, treatments are fixed.

In randomized block design don’t take blocking variable out of the model even if it’s non-significant

Analyzing a randomized block design? Need to have 1 observation per level of fixed effect per block. (Repeated records per block)

“Repeat after me – I will never use PROC GLM again”

Why would you find an interaction between block & treatment if assignment was truly random?

Kolmogorov-Smirnov is a test for significance of difference in vodka quality (ok, I lied it really tests normality)

For random effects in ~~#~~**SAS** EG click random effects, then ADD, then click … to select effect (as in, click on three dots)

Half the benefit of the ~~#~~**SAS** classes is the book of notes they give you. Like how the mixed one explains every bit of output. (It would be nice if it explained every option in the screens, too)

~~#~~**SAS** will also be offering a GLIMMIX workshop in San Diego in June, I hear. Really nice to have close to home

~~#~~**SAS** workshops for professors are free, just FYI

Mixed models are robust to departures from normality “If it aint too bad”

The larger your n, the harder to get normality because a larger n makes it easier to reject a slight departure from normality

Two problems in regression – non-normality and non-constant variance

In mixed models, non-constant variance can be accommodated, unlike in regression where we assume constant variance

To inspect normality of residuals, look at quantile plots <– sentence which made sense to me

In mixed models errors are assumed to be neither independent nor homogeneous

PROC MIXED allows for different covariance structures

Fixed effects specified in MODEL statement. Random effects specified in RANDOM statement

2 methods to obtain mixed estimates, maximum likelihood and restricted maximum likelihood (REML)

In general REML estimators of the variance components are unbiased in PROC MIXED while ML estimates are biased low

V = ZGZ’ + R used in generalized least squares method

“Kenward-Rogers degrees of freedom is Satterthwaite on steroids” – recommend as PROC MIXED df method. May give fractional df

Generalized Linear and Nonlinear Models for Correlated Data: Theory and Applications Using SAS by Vonesh. Recommended text.

Nested effect – hierarchical data structure in which smaller experimental unit is nested within larger one, e.g., students within classes

PROC GLM contrast statement uses ‘/’ where PROC MIXED uses ‘|’

CONTRAST ’3 levels’ varname 1 -1 0 ; = How to write contrast statement in PROC MIXED to test diff between means of variable with 3 levels

ESTIMATE ‘level 3 mean’ int 1 varname 0 0 1 = estimates mean at lvl 3 for varname variable – how to code PROC MIXED ESTIMATE statement

M1* is the average mean over all levels of M. (Sum of M11 – M1K)/(number levels)

~~#~~**SAS** EG PROC MIXED does not include Type IV hypothesis test (never noticed that before)

Should not use Type III SS when treatment combination is missing. What then?

The answer to that last question is that there is no easy answer

R(a|μ b) testing for main effect a, adjusting for the intercept and main effect b, but is that really what you are doing?

Reminder: Type I is model-order dependent while Type II, III are model order independent

Recommends starting with the general model testing for unequal slopes and unequal intercepts

in ~~#~~**SAS** EG on line plot go to INTERPOLATIONS under APPEARANCE and select REGRESSION to get a regression line

PROC MIXED like ANOVA, GLM, interaction tests whether the slopes are equal. Main effect tests whether intercepts are equal

random coefficient model includes term for variation around mean for level of the random effect

PROC GLM ANCOVA assumes intercepts are fixed. Random coefficients model assumes they are random

An effect can be considered both fixed and random (I did not know that)

# Comments

**2 Responses to “Mixed Models Workshop – My notes in tweets”**

**Leave a Reply**

When I was reading your tweets while you were in class, I couldn’t help but think of Paul Allison’s 2005 book, Fixed Effects Regression Methods for Longitudinal Data (FERMLD). I had a chance to read that book in some detail while I was traveling last August. If you’re not familiar with FEMRLD, it’s a great comparison of various fixed methods, very logically organized and provides insight into the tradeoffs for all the PROCs available for this subject area Lot’s of good examples with code online, too. I saw your recommendation of Vonesh –I checked the sample pages in Amazon and just felt it was not as straightforward as Allison. Surprisingly, Vonesh doesn’t not cite Allison’s FERMLD work in his biblio. Nonetheless, if you’re not familiar with FERMLD, it seems like you line of work would find it useful.

Enjoy your tweets and blog.

Cheers,

Following you as: dgrisman

David Griscavage

Thanks very much for the recommendation. I’ve read a couple of Allison’s articles and liked them. I’ll check out the book. I’ve got TWO grants due in February but after that I should have some down time to just read and relax.