Help using Base SAS procedures

GLIMMIX with two repeated measures variables

Senior User
Posts: 1

GLIMMIX with two repeated measures variables



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.

Posts: 404

Re: GLIMMIX with two repeated measures variables

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.



Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation