I don’t understand why when adding multiple fixed effects in different orders changes my output results. Shouldn’t the output be the same if I run each fixed effect individually as opposed to all at once since the models test them individually as well?
Here’s my code and output for each mod that I run:
## Make "Nesting" appear first
>mod1 <- lmer(Intertegular.Width ~ Nesting*Diet*Sociality + (1|Genus) + (1|Sex), data=df)
Response: Intertegular.Width
Chisq Df Pr(>Chisq)
Nesting 0.6854 1 0.4077
Diet 0.1703 1 0.6799
Sociality 0.3300 1 0.5657
Nesting:Diet 0
Nesting:Sociality 0
Diet:Sociality 0
Nesting:Diet:Sociality 0
## Make "Nesting" appear last
>mod2 <- lmer(Intertegular.Width ~ Sociality*Diet*Nesting + (1|Genus) + (1|Sex), data=df)
Response: Intertegular.Width
Chisq Df Pr(>Chisq)
Sociality 0.7198 2 0.6977
Diet 0.1703 1 0.6799
Nesting 0
Sociality:Diet 0
Sociality:Nesting 0
Diet:Nesting 0
Sociality:Diet:Nesting 0
## Nesting by itself
>mod3 <- lmer(Intertegular.Width ~ Nesting + (1|Genus) + (1|Sex), data=df)
Response: Intertegular.Width
Chisq Df Pr(>Chisq)
Nesting 2.9 1 0.08858 .
I am trying to see if different functional traits for bees impact their body size (functional traits are tied into genus so I include genus as a random effect, and sex of bees also greatly impacts body size so that is another random effect).
Why does nesting produce wildly different results? This is also true for other functional traits I am testing. So how do I know which model form is the best one to use if they’re all so different?
EDIT some more info about my dataset but I removed some columns, because it would be way too much to paste. I include just the stuff that I think is meaningful:
> str(df)
$ Month : chr [1:6209] "May" "May" "May" "May" ...
$ Year : Factor w/ 3 levels "2021","2022",..: 1 1 1 1 1 1 1 1 1 1 ...
$ Specimen : chr [1:6209] "RBL-002085" "RBL-002092" "RBL-002093" "RBL-002094" ...
$ SiteID : Factor w/ 29 levels "H02","H03","H04",..: 23 17 17 17 17 17 17 17 17 17 ...
$ Genus : chr [1:6209] "Ceratina" "Ceratina" "Ceratina" "Ceratina" ...
$ Sex : chr [1:6209] "M" "F" "F" "F" ...
$ Urban.Intensity : Factor w/ 3 levels "HIGH","MEDIUM",..: 2 3 3 3 3 3 3 3 3 3 ...
$ Sociality : Factor w/ 3 levels "Social","Solitary",..: 3 3 3 3 3 3 3 3 3 3 ...
$ Nesting : Factor w/ 2 levels "Cavity","Ground": 1 1 1 1 1 1 1 1 1 1 ...
$ Diet : Factor w/ 2 levels "Generalist","Specialist": 1 1 1 1 1 1 1 1 1 1 ...
$ Origin : chr [1:6209] "Native" "Native" "Native" "Native" ...
$ Head.Width : num [1:6209] 1.35 1.58 1.68 1.49 1.25 ...
$ Wing.Wear : num [1:6209] 0 0 0 0 0 2 0 0 0 2 ...
$ Intertegular.Width : num [1:6209] 1.19 1.25 1.49 1.29 1.16 ...
$ Body.Size : chr [1:6209] "Small" "Small" "Small" "Small"
7