mercredi 5 septembre 2018

GLMM script with fixed and random variables

I am trying to create a model in R that accounts for my survey. The study involves many explanatory variable, the response variable is called ''HUNTED'' and the data is about 3 distinct time PERIODS. My dataset is too large, I've just added a part of it so you can understand how its distribution is. My question is if I leave the variable PERIOD in the script like I did, do will the program ''understand'' that in the PERIOD level called ''before'' there were fewer hunted species than in the PERIODO level called ''DURING''? And so because of that the level DURING appears more significant, or am I misunderstanding the results? Obs.: The PERIOD level called AFTER is not appearing in console because it have been used like ''base level''.

The results I got in console are:

Random effects: Groups Name Variance Std.Dev. Specie (Intercept) 1.728 1.314
Number of obs: 5622, groups: Specie, 25

Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.611e+01 2.510e+00 -6.420 1.36e-10 * eco 9.337e-02 6.522e-02 1.432 0.152254
TrophicLevel 4.403e-01 3.561e-01 1.236 0.216324
age 8.676e-04 2.616e-03 0.332 0.740175
log(body_mass) 8.717e+00 1.495e+00 5.833 5.46e-09
habitat -5.238e-01 8.269e-02 -6.335 2.37e-10 ABUND 4.432e-01 4.938e-02 8.976 < 2e-16 * BEFORE -2.850e-01 1.090e-01 -2.615 0.008932 ** DURING 3.478e-01 9.103e-02 3.821 0.000133 *** taboo -1.057e+00 1.016e+00 -1.041 0.297926

allspecies4<-read.csv(file= "dataGLMM.csv", header= TRUE, sep= ";" )
attach(allspecies4)
library(lme4)
allspecies4<- glmer(HUNTED~ eco+TrophicLevel+age+ log(body_mass)+
                      habitat+ABUND + PERIOD + tabu +(1|Specie),
                    data=dataGLMM, family=binomial)

summary(allspecies4)
Specie      body_mass       TrophicLevel    age     eco     habitat PERIOD  HUNTED  ABUND   tabu
Cerc_mit        3.7     2       57      2       F       DURING  0       2       1
Cerc_mit        3.7     2       57      2       F       AFTER   0       3       1
Cerc_mit        3.7     2       57      2       F       BEFORE  0       4       1
Cerc_mit        3.7     2       67      2       F       DURING  1       2       1
Cerc_mit        3.7     2       67      2       F       AFTER   0       2       1
Chlor_cyn       3.7     2       53      2       S       DURING  0       3       0
Chlor_cyn       3.7     2       74      2       S       DURING  0       3       0
Chlor_cyn       3.7     2       30      2       S       DURING  0       4       0
Chlor_cyn       3.7     2       63      2       S       DURING  0       4       0
Chlor_cyn       3.7     2       54      2       S       DURING  0       3       0
Chlor_cyn       3.7     2       30      2       S       DURING  0       4       0
Chlor_cyn       3.7     2       30      2       S       DURING  0       3       0
Phil_mont       3.69    2       24      3       F       DURING  0       3       0
Phil_mont       3.69    2       24      3       F       BEFORE  0       4       0
Phil_mont       3.69    2       33      3       F       AFTER   1       4       0
Phil_mont       3.69    2       33      3       F       BEFORE  0       4       0
Phil_mont       3.69    2       33      3       F       DURING  0       4       0
Phil_mont       3.69    2       43      3       F       BEFORE  0       4       0
Phil_mont       3.69    2       43      3       F       DURING  0       4       0



Aucun commentaire:

Enregistrer un commentaire