# Why proc mixed give different DF than proc glimmix?

I am trying to move data analysis from proc mixed to glimmix for the easy of the ilink transformation. However I am finding a big difference on the denominator DF when using either of them. As background. My data comes from a group of 95 calves that were fed 4 diets (about 24 calves per diet), my measure is neutrophil number in blood which was repeated 4 times (7, 14, 28, 42 d of age). Thus I am using sp (pow) as cov structure. When using proc mixed with next statements: I got about 85 DF for the diff contrasts

CLASS calf diet parity sex age;
MODEL  RBCx=  diet sex age diet*sex diet*age  sex*age diet*sex*age / DDFM=KR;;
random calf (diet*sex);
repeated age /type=sp(pow)(age)  subject=calf (diet*sex) ;


However when using proc glimmix, for same contrast I got 336 DF when using next:

proc glimmix data = CBC_2011 IC= PQ;
CLASS calf diet parity sex age;
MODEL  RBCx=  diet sex age diet*sex diet*age  sex*age diet*sex*age / dist=Gaussian DDFM=KR;;
random age /type=sp(pow)(age)  subject=calf (diet*sex) residual;


-

In the mixed procedure code you specified a random statement and a repeated statement. The first one affects the G-matrix (and therefore the DFs), the second only affects the R-matrix. Your glimmix procedure code only contains a random statement with a residual option which therefore only affects the R-matrix and acts as the repeated statement in the mixed procedure. I think for proc glimmix you need a second random statement identical to the random statement of the mixed procedure.

In reply to Mike's comment I try to clarify the notation: The normal mixed model (proc mixed) can be written as: $y=X \alpha + Z \beta + e$, where $\alpha$ represents the fixed effects and $\beta$ the random effects with $\beta \sim N(0, G)$ and $var(e)=R$, so that $var(y)=V=ZGZ' +R$.

In the generalized linear mixed model (proc glimmix) this is analogous: $y=\mu+e$, where $g(\mu)=X \alpha + Z \beta$, $var(e)=R$ and therefore $var(y)=V=var(\mu)+R \approx BZGZ'B +R$, $B$ being a diagonal matrix of variance terms.

-
Can you clarify what you're referring to when you say 'G-matrix' and 'R-matrix'? –  Mike Wierzbicki Oct 21 '11 at 12:47
Also see the SAS Mixed Documentation –  Aaron Oct 21 '11 at 15:58
Thanks @PSJ, I just run including other second random term [random calf (diet*sex)] and now the DF are the same as with proc mixed. However since I am running a bunch of variables for blood cells which all are under the same SAS codes just changing the model with the corresponding response variable.The new problem I am facing is that for some of my variables the convergencia criteria is not satisfied thus my covariance paramenters can not be estimates or some of them it is satisfied but at the time to give the cov parameter the estimate give zero and the standard error "." So got no solution –  Miriam Oct 23 '11 at 14:08
... Oh also I should indicate that if working with proc mixed those get solved ..The only reason I would like to keep working on proc glimmix is the advantage of having the ilink option since most all of my variables needs to be transformed to reach normality, this because with proc mixed the transformation back can not be done directly, so doing manually I am not able to calculate back he standard error of the mean. If any one knows the formulas to transform back SEM from inverse square root and other common transformations will also be appreciated. –  Miriam Oct 23 '11 at 14:12
Miriam, maybe these question(s) ( (a) convergence problem, (b) back transformation to solve (a)) attract more attention when posted as new question(s). –  psj Oct 25 '11 at 9:34