lIEN DE PUBLICATION : https://rpubs.com/theophile_kabasele/1448368

iMPORTATION DES DONNÉES

FONCTION QUI TRANSFORME LES BD DES PERTURBATIONS EN DONNÉES BINAIRES

RAJOUTER LES PERTURBATIONS BINAIRES AUX BASES DE DONNÉES

On transforme les perturbation de binaire en variable catégorielle.

TRansformation de la BD

On va joindre les 2 tableaux intermediaires

on ressort les fenettes temporelles par site pour la v.rification

MODELE linéaire AVEC RATIO

ERR

Plot de début de

Modélisation

On applique le modèle

lmer_Ratio <- lmer(mean_Ratio ~ Perturbation*Position + (1 | Id) + (1 | Site) , data = bl_fenetre_finale2_ERR, REML=T) # Effet d'croisée entre Id et Site

anova(lmer_Ratio)
Type III Analysis of Variance Table with Satterthwaite's method
                         Sum Sq   Mean Sq NumDF
Perturbation          0.0237695 0.0237695     1
Position              0.0160758 0.0160758     1
Perturbation:Position 0.0046876 0.0046876     1
                       DenDF F value   Pr(>F)   
Perturbation          684.44  9.2956 0.002386 **
Position              762.50  6.2868 0.012371 * 
Perturbation:Position 760.59  1.8332 0.176153   
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(lmer_Ratio)
Linear mixed model fit by REML. t-tests use
  Satterthwaite's method [lmerModLmerTest]
Formula: 
mean_Ratio ~ Perturbation * Position + (1 | Id) + (1 | Site)
   Data: bl_fenetre_finale2_ERR

REML criterion at convergence: -2366

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-2.6587 -0.6465 -0.1348  0.4405  8.9524 

Random effects:
 Groups   Name        Variance  Std.Dev.
 Id       (Intercept) 0.000e+00 0.000000
 Site     (Intercept) 7.028e-05 0.008383
 Residual             2.557e-03 0.050567
Number of obs: 769, groups:  Id, 260; Site, 8

Fixed effects:
                                 Estimate
(Intercept)                      0.025625
Perturbationtbe                 -0.019539
Positionbefore                   0.004976
Perturbationtbe:Positionbefore   0.011647
                               Std. Error
(Intercept)                      0.005579
Perturbationtbe                  0.005482
Positionbefore                   0.007409
Perturbationtbe:Positionbefore   0.008602
                                       df t value
(Intercept)                     36.286610   4.593
Perturbationtbe                743.160878  -3.564
Positionbefore                 758.707605   0.672
Perturbationtbe:Positionbefore 760.590375   1.354
                               Pr(>|t|)    
(Intercept)                     5.1e-05 ***
Perturbationtbe                0.000388 ***
Positionbefore                 0.502000    
Perturbationtbe:Positionbefore 0.176153    
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) Prtrbt Pstnbf
Perturbtntb -0.736              
Positionbfr -0.503  0.511       
Prtrbtntb:P  0.439 -0.600 -0.860
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')

Conclusion : le modèle est significatif. Il y a donc une différence significative de la moyenne du BAI entre type de perturbations.

VALIDATION DU MODÈLE

3.1 Vérifier l’homogénéité de la variance : Résidus vs Prédits (détection globale)

Interprétation : Étendue non-homogène des résidus -> la supposition non- respectée!

Q-Q PLOT

####3.2 Vérifier l’indépendance des résidus avec chaque covariable

EFFETS FIXES
Pour Pert_type (facteur)

Pour Year (facteur)

Pour l’interaction Pert_type:Year

EFFETS ALÉATOIRES

Interprétation : Étendue homogène des résidus autour de 0 -> pas de patron des résidus en fonction de la variable, la supposition n’est pas respectée!

3.3 Vérifier la normalité des résidus

Interprétation : Des résidus suivant une distribution normale indiquent que le modèle n’est pas biaisé.

CONCLUSION : FAIRE LA TRANSFORMATION LOGARITHMIQUE

Transformation logarithmique

#bl_fenetre_finale2_ERR$mean.Ratio_log <- log(bl_fenetre_finale2_ERR$mean_Ratio)  # Ajoute une colonne transformée

# Transformation pour la modélisation
bl_fenetre_finale2_ERR$mean.Ratio_log <- sign(bl_fenetre_finale2_ERR$mean_Ratio) *
                                         log(abs(bl_fenetre_finale2_ERR$mean_Ratio) + 1)

lmer_Ratio_log <- lmer(mean.Ratio_log ~ Perturbation*Position + (1 | Id) + (1 | Site), data = bl_fenetre_finale2_ERR, REML=T)

summary(lmer_Ratio_log)
Linear mixed model fit by REML. t-tests use
  Satterthwaite's method [lmerModLmerTest]
Formula: 
mean.Ratio_log ~ Perturbation * Position + (1 | Id) + (1 | Site)
   Data: bl_fenetre_finale2_ERR

REML criterion at convergence: -2468.2

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-2.6729 -0.6567 -0.1308  0.4675  7.7290 

Random effects:
 Groups   Name        Variance  Std.Dev.
 Id       (Intercept) 0.000e+00 0.00000 
 Site     (Intercept) 6.115e-05 0.00782 
 Residual             2.238e-03 0.04730 
Number of obs: 769, groups:  Id, 260; Site, 8

Fixed effects:
                                 Estimate
(Intercept)                      0.024117
Perturbationtbe                 -0.018400
Positionbefore                   0.004952
Perturbationtbe:Positionbefore   0.010617
                               Std. Error
(Intercept)                      0.005215
Perturbationtbe                  0.005128
Positionbefore                   0.006931
Perturbationtbe:Positionbefore   0.008047
                                       df t value
(Intercept)                     36.340032   4.625
Perturbationtbe                742.855826  -3.588
Positionbefore                 758.695967   0.714
Perturbationtbe:Positionbefore 760.589415   1.319
                               Pr(>|t|)    
(Intercept)                    4.62e-05 ***
Perturbationtbe                0.000355 ***
Positionbefore                 0.475173    
Perturbationtbe:Positionbefore 0.187402    
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) Prtrbt Pstnbf
Perturbtntb -0.736              
Positionbfr -0.504  0.511       
Prtrbtntb:P  0.440 -0.600 -0.860
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
anova(lmer_Ratio_log)
Type III Analysis of Variance Table with Satterthwaite's method
                         Sum Sq   Mean Sq NumDF
Perturbation          0.0216565 0.0216565     1
Position              0.0145101 0.0145101     1
Perturbation:Position 0.0038957 0.0038957     1
                       DenDF F value   Pr(>F)   
Perturbation          683.52  9.6786 0.001942 **
Position              762.51  6.4848 0.011076 * 
Perturbation:Position 760.59  1.7411 0.187402   
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Vérification dU MODÈLE

Q-Q PLOT

Graphique du modèle

GRAPHIQUE

Tous les sites ensembles

GRAPHIQUE GLOBAL

BOP

Plot de début de

Modélisation

On applique le modèle

lmer_Ratio_BOP <- lmer(mean_Ratio ~ Perturbation*Position + (1 | Id) + (1 | Site) , data = bl_fenetre_finale2_BOP, REML=T) # Effet d'croisée entre Id et Site

anova(lmer_Ratio_BOP)
Type III Analysis of Variance Table with Satterthwaite's method
                        Sum Sq  Mean Sq NumDF
Perturbation          0.048955 0.048955     1
Position              0.017046 0.017046     1
Perturbation:Position 0.070940 0.070940     1
                       DenDF F value    Pr(>F)
Perturbation          638.48  9.1704 0.0025588
Position              764.90  3.1931 0.0743453
Perturbation:Position 763.27 13.2887 0.0002851
                         
Perturbation          ** 
Position              .  
Perturbation:Position ***
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(lmer_Ratio_BOP)
Linear mixed model fit by REML. t-tests use
  Satterthwaite's method [lmerModLmerTest]
Formula: 
mean_Ratio ~ Perturbation * Position + (1 | Id) + (1 | Site)
   Data: bl_fenetre_finale2_BOP

REML criterion at convergence: -1809.2

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-2.3972 -0.6261 -0.1544  0.5542  6.1535 

Random effects:
 Groups   Name        Variance  Std.Dev.
 Id       (Intercept) 0.000e+00 0.00000 
 Site     (Intercept) 5.914e-05 0.00769 
 Residual             5.338e-03 0.07306 
Number of obs: 770, groups:  Id, 254; Site, 8

Fixed effects:
                                 Estimate
(Intercept)                      0.019097
Perturbationtbe                 -0.040452
Positionbefore                  -0.011107
Perturbationtbe:Positionbefore   0.043619
                               Std. Error
(Intercept)                      0.007482
Perturbationtbe                  0.008016
Positionbefore                   0.010162
Perturbationtbe:Positionbefore   0.011966
                                       df t value
(Intercept)                     64.647961   2.552
Perturbationtbe                704.205038  -5.046
Positionbefore                 761.961248  -1.093
Perturbationtbe:Positionbefore 763.274638   3.645
                               Pr(>|t|)    
(Intercept)                    0.013073 *  
Perturbationtbe                5.74e-07 ***
Positionbefore                 0.274749    
Perturbationtbe:Positionbefore 0.000285 ***
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) Prtrbt Pstnbf
Perturbtntb -0.807              
Positionbfr -0.597  0.557       
Prtrbtntb:P  0.516 -0.648 -0.849
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')

Conclusion : le modèle est significatif. Il y a donc une différence significative de la moyenne du BAI entre type de perturbations.

VALIDATION DU MODÈLE

3.1 Vérifier l’homogénéité de la variance : Résidus vs Prédits (détection globale)

Interprétation : Étendue non-homogène des résidus -> la supposition non- respectée!

Q-Q PLOT

####3.2 Vérifier l’indépendance des résidus avec chaque covariable

EFFETS FIXES
Pour Pert_type (facteur)

Pour Year (facteur)

Pour l’interaction Pert_type:Year

EFFETS ALÉATOIRES

Interprétation : Étendue homogène des résidus autour de 0 -> pas de patron des résidus en fonction de la variable, la supposition n’est pas respectée!

3.3 Vérifier la normalité des résidus

Interprétation : Des résidus suivant une distribution normale indiquent que le modèle n’est pas biaisé.

CONCLUSION : FAIRE LA TRANSFORMATION LOGARITHMIQUE

Transformation logarithmique

#bl_fenetre_finale2_BOP$mean.Ratio_log <- log(bl_fenetre_finale2_BOP$mean_Ratio)  # Ajoute une colonne transformée

# Transformation pour la modélisation
bl_fenetre_finale2_BOP$mean.Ratio_log <- sign(bl_fenetre_finale2_BOP$mean_Ratio) *
                                         log(abs(bl_fenetre_finale2_BOP$mean_Ratio) + 1)

lmer_Ratio_log_BOP <- lmer(mean.Ratio_log ~ Perturbation*Position + (1 | Id) + (1 | Site), data = bl_fenetre_finale2_BOP, REML=T)

summary(lmer_Ratio_log_BOP)
Linear mixed model fit by REML. t-tests use
  Satterthwaite's method [lmerModLmerTest]
Formula: 
mean.Ratio_log ~ Perturbation * Position + (1 | Id) + (1 | Site)
   Data: bl_fenetre_finale2_BOP

REML criterion at convergence: -1915.4

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-2.3742 -0.6444 -0.1558  0.5778  5.3717 

Random effects:
 Groups   Name        Variance  Std.Dev.
 Id       (Intercept) 0.000e+00 0.000000
 Site     (Intercept) 4.985e-05 0.007061
 Residual             4.648e-03 0.068176
Number of obs: 770, groups:  Id, 254; Site, 8

Fixed effects:
                                 Estimate
(Intercept)                      0.017391
Perturbationtbe                 -0.037996
Positionbefore                  -0.010710
Perturbationtbe:Positionbefore   0.041217
                               Std. Error
(Intercept)                      0.006964
Perturbationtbe                  0.007478
Positionbefore                   0.009482
Perturbationtbe:Positionbefore   0.011165
                                       df t value
(Intercept)                     64.325637   2.497
Perturbationtbe                700.005713  -5.081
Positionbefore                 761.933519  -1.129
Perturbationtbe:Positionbefore 763.276858   3.692
                               Pr(>|t|)    
(Intercept)                    0.015087 *  
Perturbationtbe                4.82e-07 ***
Positionbefore                 0.259062    
Perturbationtbe:Positionbefore 0.000239 ***
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) Prtrbt Pstnbf
Perturbtntb -0.809              
Positionbfr -0.599  0.558       
Prtrbtntb:P  0.517 -0.648 -0.849
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
anova(lmer_Ratio_log_BOP)
Type III Analysis of Variance Table with Satterthwaite's method
                        Sum Sq  Mean Sq NumDF
Perturbation          0.042620 0.042620     1
Position              0.014584 0.014584     1
Perturbation:Position 0.063347 0.063347     1
                       DenDF F value    Pr(>F)
Perturbation          631.02  9.1696 0.0025612
Position              764.94  3.1378 0.0768948
Perturbation:Position 763.28 13.6290 0.0002386
                         
Perturbation          ** 
Position              .  
Perturbation:Position ***
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Vérification dU MODÈLE

Q-Q PLOT

Graphique du modèle

GRAPHIQUE

Tous les sites ensembles

GRAPHIQUE GLOBAL

SAB

Plot de début de

Modélisation

On applique le modèle

lmer_Ratio_SAB <- lmer(mean_Ratio ~ Perturbation*Position + (1 | Id) + (1 | Site) , data = bl_fenetre_finale2_SAB, REML=T) # Effet d'croisée entre Id et Site

anova(lmer_Ratio_SAB)
Type III Analysis of Variance Table with Satterthwaite's method
                      Sum Sq Mean Sq NumDF  DenDF
Perturbation          0.0351  0.0351     1 186.38
Position              4.1232  4.1232     1 309.49
Perturbation:Position 0.0586  0.0586     1 312.98
                      F value    Pr(>F)    
Perturbation           0.5359    0.4651    
Position              62.9735 3.876e-14 ***
Perturbation:Position  0.8950    0.3449    
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(lmer_Ratio_SAB)
Linear mixed model fit by REML. t-tests use
  Satterthwaite's method [lmerModLmerTest]
Formula: 
mean_Ratio ~ Perturbation * Position + (1 | Id) + (1 | Site)
   Data: bl_fenetre_finale2_SAB

REML criterion at convergence: 58

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-8.0170 -0.3073  0.0813  0.4719  3.7953 

Random effects:
 Groups   Name        Variance  Std.Dev. 
 Id       (Intercept) 5.184e-17 7.200e-09
 Site     (Intercept) 3.576e-03 5.980e-02
 Residual             6.548e-02 2.559e-01
Number of obs: 317, groups:  Id, 189; Site, 8

Fixed effects:
                                 Estimate
(Intercept)                      0.165263
Perturbationtbe                 -0.005069
Positionbefore                  -0.381062
Perturbationtbe:Positionbefore   0.082311
                               Std. Error
(Intercept)                      0.053161
Perturbationtbe                  0.052518
Positionbefore                   0.077351
Perturbationtbe:Positionbefore   0.087005
                                       df t value
(Intercept)                     62.961510   3.109
Perturbationtbe                268.155361  -0.097
Positionbefore                 310.173505  -4.926
Perturbationtbe:Positionbefore 312.984082   0.946
                               Pr(>|t|)    
(Intercept)                     0.00282 ** 
Perturbationtbe                 0.92317    
Positionbefore                 1.37e-06 ***
Perturbationtbe:Positionbefore  0.34485    
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) Prtrbt Pstnbf
Perturbtntb -0.855              
Positionbfr -0.468  0.469       
Prtrbtntb:P  0.413 -0.486 -0.898
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')

Conclusion : le modèle est significatif. Il y a donc une différence significative de la moyenne du BAI entre type de perturbations.

VALIDATION DU MODÈLE

3.1 Vérifier l’homogénéité de la variance : Résidus vs Prédits (détection globale)

Interprétation : Étendue non-homogène des résidus -> la supposition non- respectée!

Q-Q PLOT

####3.2 Vérifier l’indépendance des résidus avec chaque covariable

EFFETS FIXES
Pour Pert_type (facteur)

Pour Year (facteur)

Pour l’interaction Pert_type:Year

EFFETS ALÉATOIRES

Interprétation : Étendue homogène des résidus autour de 0 -> pas de patron des résidus en fonction de la variable, la supposition n’est pas respectée!

3.3 Vérifier la normalité des résidus

Interprétation : Des résidus suivant une distribution normale indiquent que le modèle n’est pas biaisé.

CONCLUSION : FAIRE LA TRANSFORMATION LOGARITHMIQUE

Transformation logarithmique

#bl_fenetre_finale2_SAB$mean.Ratio_log <- log(bl_fenetre_finale2_SAB$mean_Ratio)  # Ajoute une colonne transformée

# Transformation pour la modélisation
bl_fenetre_finale2_SAB$mean.Ratio_log <- sign(bl_fenetre_finale2_SAB$mean_Ratio) *
                                         log(abs(bl_fenetre_finale2_SAB$mean_Ratio) + 1)

lmer_Ratio_log_SAB <- lmer(mean.Ratio_log ~ Perturbation*Position + (1 | Id) + (1 | Site), data = bl_fenetre_finale2_SAB, REML=T)

summary(lmer_Ratio_log_SAB)
Linear mixed model fit by REML. t-tests use
  Satterthwaite's method [lmerModLmerTest]
Formula: 
mean.Ratio_log ~ Perturbation * Position + (1 | Id) + (1 | Site)
   Data: bl_fenetre_finale2_SAB

REML criterion at convergence: -149

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-5.8944 -0.3639  0.0815  0.5408  3.2658 

Random effects:
 Groups   Name        Variance Std.Dev.
 Id       (Intercept) 0.000000 0.00000 
 Site     (Intercept) 0.002854 0.05342 
 Residual             0.033572 0.18323 
Number of obs: 317, groups:  Id, 189; Site, 8

Fixed effects:
                                 Estimate
(Intercept)                      0.148700
Perturbationtbe                 -0.009921
Positionbefore                  -0.289396
Perturbationtbe:Positionbefore   0.047194
                               Std. Error
(Intercept)                      0.040062
Perturbationtbe                  0.038018
Positionbefore                   0.055445
Perturbationtbe:Positionbefore   0.062472
                                       df t value
(Intercept)                     52.507173   3.712
Perturbationtbe                292.924385  -0.261
Positionbefore                 309.309081  -5.220
Perturbationtbe:Positionbefore 312.405782   0.755
                               Pr(>|t|)    
(Intercept)                    0.000499 ***
Perturbationtbe                0.794301    
Positionbefore                  3.3e-07 ***
Perturbationtbe:Positionbefore 0.450554    
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) Prtrbt Pstnbf
Perturbtntb -0.822              
Positionbfr -0.439  0.458       
Prtrbtntb:P  0.386 -0.475 -0.897
optimizer (nloptwrap) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')
anova(lmer_Ratio_log_SAB)
Type III Analysis of Variance Table with Satterthwaite's method
                       Sum Sq Mean Sq NumDF
Perturbation          0.00485 0.00485     1
Position              2.51727 2.51727     1
Perturbation:Position 0.01916 0.01916     1
                       DenDF F value   Pr(>F)    
Perturbation          239.07  0.1445   0.7041    
Position              308.73 74.9808 2.69e-16 ***
Perturbation:Position 312.41  0.5707   0.4506    
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Vérification dU MODÈLE

Q-Q PLOT

Graphique du modèle

GRAPHIQUE

Tous les sites ensembles

GRAPHIQUE GLOBAL