BookmarkSubscribeRSS Feed
Calcite | Level 5



I'm new to GLMMs and want to check that I have used the appropriate syntax for my analyses.  I'm analysing a longitudinal study looking at children's ('subject') behaviours ('beh') towards eleven different stimuli ('stimulus') at four different timepoints ('time').  Time and stimulus are repeated measures variables as all children were exposed to all stimuli at all timepoints.  I'm testing against a Poisson distribution because the behavioural data are counts (and there is no overdispersion).


My basic syntax looks like this:

proc glimmix data=data method=laplace ic=q;
class subject stimulus;
model beh = stimulus time stimulus*time / s dist=Poisson;
random int / subject=subject;
random stimulus / subject=subject;
random time / type=AR(1) subject=subject;

nloptions tech=quanew;


I'm testing these full models against nested models with fewer fixed effects (stimulus & time without the interaction, stimulus only, time only, and a null model with no fixed effects) and selecting models on the basis of their AIC values.


Are these analyses appropriate for my data?


Many thanks.

Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

There are many ways to construct a covariance matrix for subjects with a single repeated measurement factor, and there are very many more ways when there are two repeated measures factors. In the MIXED procedure, we have access to Kronecker products (UN@UN, UN@AR(1), and UN@CS), but these options don't exist for GLIMMIX. And there could be more parsimonious covariance matrices than those using UN. I would think that logic and context could help determine plausible structures--what might be correlated and in what fashion.


You might find this paper by Tao, Kiernan and Gibbs (2015) to be helpful:


I dinked around with various constructions awhile back. I'll attach my code. I won't guarantee that the code (or the descriptions within) are correct, it really ought to be thought of as a work in progress. But perhaps it will be of some use. 


As far as your modeling protocol goes, once you settle on a covariance structure, then you could base model selection on AIC (because Laplace is a maximum likelihood method). But I wouldn't; I usually use the approximate tests provided by GLIMMIX, using ddfm=kr, provided the model converges and estimation is decent. For an R-world opinion, see "What is the best way to test hypotheses on effects in GLMMs?" at


Hope this helps.





Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation