Differences in estimate between lmer model and tukey test

48 views Asked by At

I'm a beginner in statistics but i cannot understand this problem I have.

I want to test the impact of Compost and Amendement on the soil coverage. For that, I use a lmer model as such :

modg <- lmer(log(Couverture)~ as.factor(Compost) * Amendement + (1|Bande), data= rvg)

Both of the fixed effects are qualitative data. Compost factors are : 20, 30 or 40 Amendement factors are : Aucun, Myco_com, Myco_site, Prebiotique

Here is the summary i get :

Fixed effects:
                                           Estimate Std. Error      df t value Pr(>|t|)    
(Intercept)                                  0.8044     0.5171 16.0414   1.556 0.139273    
as.factor(Compost)30                         1.2920     0.6822 19.9815   1.894 0.072827 .  
as.factor(Compost)40                         1.0211     0.7248 11.5907   1.409 0.185141    
AmendementMyco_com                           2.6701     0.4770 32.5073   5.598 3.31e-06 ***
AmendementMyco_site                          2.4687     0.5043 33.9108   4.896 2.36e-05 ***
AmendementPrebiotique                        1.3416     0.4939 32.2909   2.716 0.010522 *  
as.factor(Compost)30:AmendementMyco_com     -3.2280     0.6679 32.9430  -4.833 3.02e-05 ***
as.factor(Compost)40:AmendementMyco_com     -3.3412     0.6590 32.3456  -5.070 1.58e-05 ***
as.factor(Compost)30:AmendementMyco_site    -3.2795     0.6809 33.6309  -4.817 3.04e-05 ***
as.factor(Compost)40:AmendementMyco_site    -3.0393     0.6790 33.1761  -4.476 8.48e-05 ***
as.factor(Compost)30:AmendementPrebiotique  -1.6666     0.6713 32.2333  -2.483 0.018439 *  
as.factor(Compost)40:AmendementPrebiotique  -2.4807     0.6757 32.3685  -3.671 0.000863 ***

I figured that the intercept correspond to Aucun-Compost20 due to the fact that it is only qualitative factors that are tested so the models takes the first interaction as his reference. This seems to be confirmed by my tukey test :

emmeans(modg, list(pairwise ~ Amendement*as.factor(Compost)), adjust = "tukey")

The results I get for this test is :

 Aucun  Compost20 - Myco_com Compost20          -2.6701 0.479 31.86  -5.578  0.0002
 Aucun  Compost20 - Myco_site Compost20         -2.4687 0.509 33.51  -4.852  0.0014
 Aucun  Compost20 - Prebiotique Compost20       -1.3416 0.495 31.61  -2.713  0.2658
 Aucun  Compost20 - Aucun  Compost30            -1.2920 0.735 18.29  -1.757  0.8205
 Aucun  Compost20 - Myco_com Compost30          -0.7341 0.706 20.45  -1.040  0.9943
 Aucun  Compost20 - Myco_site Compost30         -0.4811 0.706 20.45  -0.682  0.9999
 Aucun  Compost20 - Prebiotique Compost30       -0.9669 0.735 18.29  -1.315  0.9662
 Aucun  Compost20 - Aucun  Compost40            -1.0211 0.740 10.16  -1.380  0.9442
 Aucun  Compost20 - Myco_com Compost40          -0.3501 0.740 10.16  -0.473  1.0000
 Aucun  Compost20 - Myco_site Compost40         -0.4505 0.740 10.16  -0.609  0.9999
 Aucun  Compost20 - Prebiotique Compost40        0.1180 0.745 10.30   0.158  1.0000
 Myco_com Compost20 - Myco_site Compost20        0.2014 0.459 34.32   0.439  1.0000
 Myco_com Compost20 - Prebiotique Compost20      1.3286 0.433 31.54   3.070  0.1352
 Myco_com Compost20 - Aucun  Compost30           1.3782 0.697 15.01   1.977  0.7013
 Myco_com Compost20 - Myco_com Compost30         1.9361 0.666 16.78   2.906  0.2222
 Myco_com Compost20 - Myco_site Compost30        2.1890 0.666 16.78   3.286  0.1181
 Myco_com Compost20 - Prebiotique Compost30      1.7033 0.697 15.01   2.443  0.4351
 Myco_com Compost20 - Aucun  Compost40           1.6490 0.702  8.24   2.349  0.5105
 Myco_com Compost20 - Myco_com Compost40         2.3201 0.702  8.24   3.306  0.1764
 Myco_com Compost20 - Myco_site Compost40        2.2196 0.702  8.24   3.162  0.2095
 Myco_com Compost20 - Prebiotique Compost40      2.7881 0.707  8.38   3.944  0.0790
 Myco_site Compost20 - Prebiotique Compost20     1.1272 0.476 33.93   2.367  0.4534
 Myco_site Compost20 - Aucun  Compost30          1.1768 0.657 21.43   1.790  0.8066
 Myco_site Compost20 - Myco_com Compost30        1.7347 0.614 24.37   2.825  0.2298
 Myco_site Compost20 - Myco_site Compost30       1.9876 0.614 24.37   3.237  0.1066
 Myco_site Compost20 - Prebiotique Compost30     1.5018 0.657 21.43   2.284  0.5141
 Myco_site Compost20 - Aucun  Compost40          1.4476 0.682  9.42   2.121  0.6232
 Myco_site Compost20 - Myco_com Compost40        2.1187 0.682  9.42   3.104  0.2104
 Myco_site Compost20 - Myco_site Compost40       2.0182 0.682  9.42   2.957  0.2532
 Myco_site Compost20 - Prebiotique Compost40     2.5867 0.688  9.58   3.761  0.0869
 Prebiotique Compost20 - Aucun  Compost30        0.0496 0.710 16.20   0.070  1.0000
 Prebiotique Compost20 - Myco_com Compost30      0.6075 0.680 18.13   0.894  0.9983
 Prebiotique Compost20 - Myco_site Compost30     0.8604 0.680 18.13   1.266  0.9739
 Prebiotique Compost20 - Prebiotique Compost30   0.3747 0.710 16.20   0.528  1.0000
 Prebiotique Compost20 - Aucun  Compost40        0.3204 0.715  8.91   0.448  1.0000
 Prebiotique Compost20 - Myco_com Compost40      0.9915 0.715  8.91   1.387  0.9397
 Prebiotique Compost20 - Myco_site Compost40     0.8910 0.715  8.91   1.246  0.9683
 Prebiotique Compost20 - Prebiotique Compost40   1.4595 0.720  9.05   2.027  0.6732
 Aucun  Compost30 - Myco_com Compost30           0.5579 0.471 32.86   1.183  0.9867
 Aucun  Compost30 - Myco_site Compost30          0.8108 0.471 32.86   1.720  0.8464
 Aucun  Compost30 - Prebiotique Compost30        0.3251 0.455 31.47   0.715  0.9998
 Aucun  Compost30 - Aucun  Compost40             0.2708 0.706  9.24   0.384  1.0000
 Aucun  Compost30 - Myco_com Compost40           0.9419 0.706  9.24   1.335  0.9524
 Aucun  Compost30 - Myco_site Compost40          0.8414 0.706  9.24   1.192  0.9766
 Aucun  Compost30 - Prebiotique Compost40        1.4099 0.711  9.39   1.984  0.6959
 Myco_com Compost30 - Myco_site Compost30        0.2529 0.463 31.87   0.546  1.0000
 Myco_com Compost30 - Prebiotique Compost30     -0.2328 0.471 32.86  -0.494  1.0000
 Myco_com Compost30 - Aucun  Compost40          -0.2871 0.685  9.34  -0.419  1.0000
 Myco_com Compost30 - Myco_com Compost40         0.3840 0.685  9.34   0.561  1.0000
 Myco_com Compost30 - Myco_site Compost40        0.2835 0.685  9.34   0.414  1.0000
 Myco_com Compost30 - Prebiotique Compost40      0.8520 0.690  9.49   1.235  0.9710
 Myco_site Compost30 - Prebiotique Compost30    -0.4858 0.471 32.86  -1.030  0.9957
 Myco_site Compost30 - Aucun  Compost40         -0.5400 0.685  9.34  -0.789  0.9990
 Myco_site Compost30 - Myco_com Compost40        0.1311 0.685  9.34   0.191  1.0000
 Myco_site Compost30 - Myco_site Compost40       0.0306 0.685  9.34   0.045  1.0000
 Myco_site Compost30 - Prebiotique Compost40     0.5991 0.690  9.49   0.868  0.9979
 Prebiotique Compost30 - Aucun  Compost40       -0.0543 0.706  9.24  -0.077  1.0000
 Prebiotique Compost30 - Myco_com Compost40      0.6168 0.706  9.24   0.874  0.9977
 Prebiotique Compost30 - Myco_site Compost40     0.5164 0.706  9.24   0.732  0.9995
 Prebiotique Compost30 - Prebiotique Compost40   1.0849 0.711  9.39   1.526  0.9004
 Aucun  Compost40 - Myco_com Compost40           0.6711 0.455 31.47   1.476  0.9365
 Aucun  Compost40 - Myco_site Compost40          0.5706 0.455 31.47   1.255  0.9791
 Aucun  Compost40 - Prebiotique Compost40        1.1391 0.462 31.81   2.463  0.3967
 Myco_com Compost40 - Myco_site Compost40       -0.1005 0.455 31.47  -0.221  1.0000
 Myco_com Compost40 - Prebiotique Compost40      0.4680 0.462 31.81   1.012  0.9962
 Myco_site Compost40 - Prebiotique Compost40     0.5685 0.462 31.81   1.229  0.9822

So there are something logical betweens the 2 tables:

  • The line for as.factor(Compost)30 in the summary corresponds to the line "Aucun Compost20 - Aucun Compost30"
  • The line for as.factor(Compost)40 in the summary corresponds to the line "Aucun Compost20 - Aucun Compost40"
  • The line for AmendementMyco_com in the summary corresponds to the line "Aucun Compost20 - Myco_com Compost20
  • The line for AmendementMyco_site in the summary corresponds to the line "Aucun Compost20 - Myco_site Compost20 The line for AmendementPrebiotique in the summary corresponds to the line "Aucun Compost20 - Prebiotique Compost20

However, the lines after that don't match their equivalent in the tukey table. For example, as.factor(Compost)30:AmendementMyco_com should correspond to Aucun Compost20 - Myco_com Compost30 but it's not the case.I cannot understand why the values differ from that point. The intercept values in my tukey test makes way more sense if I look at the data. Can someone help me on this issue ?

I tried to look at data and to change orders of variables, to make my data as.ordered() etc but nothing worked.

0

There are 0 answers