7
$\begingroup$

I am familiar with linear regression models but the random section of linear mixed models just melts my mind. I did find an excellent guide that could have helped me but the languageR package is not compatible with newer versions of lme4 so I've been unable to implement it in my work.

For me the fixed effects are very understandable (below lactation and a higher yr2 value both contribute to a higher weight but the lactation effect is more consistent which results in a higher t-value).

The first problem is to understand what I am actually putting in. To a certain extent I understand that (1|P$grupp) means that the mixed model add to the base line (intercept) while (P$grupp|P$lweek) mean that belong to a group is expected to affect the average weight increase (or decrease) while P$lweek adds to the baseline value. But why does all tutorials seem to favor write ups like (1+P$fgrupp|P$lweek) rather than (P$grupp|P$lweek)?

Now on to the actual output (see below for full output). I've used the following models (sorry for the Swenglish but the sample is the weight of cows P$vikt is the weight at certain time points and P$lweek is the time since a calf was born, P$fgrupp is a factor telling if the cow belongs to feed group 1,2 or 3):

Formula: P$vikt ~ P$lweek + P$laktation + P$yr + (1 | P$fgrupp)            #$
Formula: P$vikt ~ P$lweek + P$laktation + P$yr + (1 + P$fgrupp | P$lweek)

Where I understand it as the first one being rather useless (essentially it tells us that the average weight of the cows isn't affected of which feed group it belongs too). This is reflected by fgrupp having variance 0 in the first formula below. The second is more interesting as the P$fgrupp|P$lweek as I understand it should show if different feed groups affect the weight increase of cows as function of the time. But I am really not competent enough to understand the input. I understand that variance somehow mean that belonging to group2 or 3 explain some of the variation in the growth curves but I really don't understand how to interpret this.

Random effects:
 Groups   Name        Variance Std.Dev. Corr        
 P$lweek  (Intercept)   13.068  3.6149                                     #$
          P$fgrupp2     77.230  8.7881  1.000                              #$
          P$fgrupp3     81.188  9.0104  1.000 1.000                        #$
 Residual             4031.831 63.4967              
Number of obs: 1048, groups: P$lweek, 84

Full output

#First model#
Linear mixed model fit by REML 
Formula: P$vikt ~ P$lweek + P$laktation + P$yr + (1 | P$fgrupp)            #$
   AIC   BIC logLik deviance REMLdev
 11703 11732  -5845    11698   11691
Random effects:
 Groups   Name        Variance Std.Dev.
 P$fgrupp (Intercept)    0.0    0.000                                      #$
 Residual             4139.9   64.342  
Number of obs: 1048, groups: P$fgrupp, 3                                   #$

Fixed effects:
            Estimate Std. Error t value
(Intercept)  509.593      4.683  108.82
P$lweek        1.028      0.105    9.79                                    #$
P$laktation   22.789      1.454   15.67                                    #$
P$yr2         35.294      4.093    8.62                                    #$

Correlation of Fixed Effects:
            (Intr) P$lwek P$lktt                                           #$
P$lweek     -0.560                                                         #$
P$laktation -0.636  0.030                                                  #$
P$yr2       -0.240 -0.034 -0.141                                           #$


#Second model#

Linear mixed model fit by REML 
Formula: P$vikt ~ P$lweek + P$laktation + P$yr + (1 + P$fgrupp | P$lweek)  #$
       AIC   BIC logLik deviance REMLdev
     11707 11761  -5842    11693   11685
    Random effects:
     Groups   Name        Variance Std.Dev. Corr        
     P$lweek  (Intercept)   13.068  3.6149                                     #$
              P$fgrupp2     77.230  8.7881  1.000                              #$
              P$fgrupp3     81.188  9.0104  1.000 1.000                        #$
     Residual             4031.831 63.4967              
    Number of obs: 1048, groups: P$lweek, 84                                   #$

Fixed effects:
            Estimate Std. Error t value
(Intercept) 508.2291     5.1770   98.17
P$lweek       1.0662     0.1192    8.94                                    #$
P$laktation  22.6525     1.4459   15.67                                    #$
P$yr2        35.6343     4.0848    8.72                                    #$

Correlation of Fixed Effects:
            (Intr) P$lwek P$lktt                                           #$$
P$lweek     -0.627                                                         #$
P$laktation -0.570  0.025                                                  #$
P$yr2       -0.224 -0.018 -0.136                                           #$
$\endgroup$
6
  • $\begingroup$ In the first model you fit a random intercept with fgrupp as a grouping factor. In the second model you fit a random intercept and a random slope for fgrupp with lweek as a grouping factor. You probably want (1 + P$lweek | P$fgrupp). $\endgroup$
    – Roland
    Commented Oct 18, 2012 at 13:28
  • 4
    $\begingroup$ Not critically important, but your code will be cleaner and more robust if you use data=P and get rid of all the P$s -- e.g. lmer(vikt ~ lweek + laktation + yr + (1 | fgrupp), data=P) $\endgroup$
    – Ben Bolker
    Commented Oct 18, 2012 at 13:35
  • $\begingroup$ Thank you but what does the 1+ section of the model actually do? $\endgroup$
    – Sigvard
    Commented Oct 19, 2012 at 11:22
  • $\begingroup$ @Roland Would you consider rephrasing your comment into an answer, so that Sigvard could accept it and mark the question as answered? $\endgroup$ Commented Sep 20, 2016 at 15:39
  • 2
    $\begingroup$ @CharlotteR They haven't visited the site since 2012. I doubt that they would accept an answer now. However, this could probably be marked as a duplicate of this question. $\endgroup$
    – Roland
    Commented Sep 20, 2016 at 15:43

1 Answer 1

4
$\begingroup$

To answer your question (or at least part of it), why do all tutorials seem to favor write ups like (1+P$fgrupp|P$lweek) rather than (P$grupp|P$lweek)... I think the answer is that they are simply trying to be more clear in their notation. (1+P$fgrupp|P$lweek) and (P$grupp|P$lweek) do yield the same results. However, (P$grupp|P$lweek) implies the existance of an estimated intercept where as (1+P$grupp|P$lweek) makes it explicit. By the way, if you didn't want to estimate the intercept you'd replace the 1 with a 0, e.g. (0+P$grupp|P$lweek).

By the way Roland is probably right. P$fgrupp|P$lweek is going to try to estimate a different effect of group for each 'lweek' you have in your data. If 'lweek' is weeks, this probably isn't the appopriate grouping factor. What is the appopriate grouping factor, type of feed or cows is going to depend on your experimental design.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.