── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.4.0 ✔ purrr 1.0.1
✔ tibble 3.1.8 ✔ dplyr 1.0.10
✔ tidyr 1.3.0 ✔ stringr 1.5.0
✔ readr 2.1.3 ✔ forcats 0.5.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
library (ggplot2)
library (lme4)
Loading required package: Matrix
Attaching package: 'Matrix'
The following objects are masked from 'package:tidyr':
expand, pack, unpack
Warning in checkDepPackageVersion(dep_pkg = "TMB"): Package version inconsistency detected.
glmmTMB was built with TMB version 1.9.1
Current TMB version is 1.9.2
Please re-install glmmTMB from source or restore original 'TMB' package (see '?reinstalling' for more information)
Loading required package: carData
lattice theme set by effectsTheme()
See ?effectsTheme for details.
Attaching package: 'car'
The following object is masked from 'package:dplyr':
recode
The following object is masked from 'package:purrr':
some
Loading required package: stats4
Attaching package: 'bbmle'
The following object is masked from 'package:dplyr':
slice
library (performance)
behavior_23Feb23 <- read.csv ("behavior_23Feb23.csv" )
behavior <- behavior_23Feb23
Fanning Model
m4 <- glmer (formula = fanning~ temp+ day_of_experiment+ infected+ total_alive+ (1 | parent), family = "poisson" , data = behavior)
plot (allEffects (m4))
temp day_of_experiment infected total_alive
1.016248 1.112137 1.018022 1.106488
Model 4.1: everything except random effect
m4.1 <- glm (formula = fanning~ temp+ day_of_experiment+ infected+ total_alive, family = "poisson" , data = behavior)
plot (allEffects (m4.1 ))
temp day_of_experiment infected total_alive
1.089218 1.142275 1.057377 1.081851
Compare to see which is better with dAIC
dAIC df
m4 0.0 6
m4.1 272.9 5
Model 4.2: everything except total_alive
m4.2 <- glmer (formula = fanning~ temp+ day_of_experiment+ infected+ (1 | parent), family = "poisson" , data = behavior)
plot (allEffects (m4.2 ))
Model 4.3: everything except infected
m4.3 <- glmer (formula = fanning~ temp+ day_of_experiment+ total_alive+ (1 | parent), family = "poisson" , data = behavior)
plot (allEffects (m4.3 ))
Model 4.4: keep everything except day_of_experiment
m4.4 <- glmer (formula = fanning~ temp+ infected+ total_alive+ (1 | parent), family = "poisson" , data = behavior)
plot (allEffects (m4.4 ))
Compare model performance
compare_performance (m4,m4.1 ,m4.2 ,m4.3 ,m4.4 , rank= TRUE )
Warning: Following indices with missing values are not used for ranking:
R2_conditional, R2_marginal, ICC, R2_Nagelkerke
# Comparison of Model Performance Indices
Name | Model | RMSE | Sigma | Score_log | Score_spherical | AIC weights | AICc weights | BIC weights | Performance-Score
----------------------------------------------------------------------------------------------------------------------------
m4 | glmerMod | 1.342 | 1.000 | -1.226 | 0.023 | 0.945 | 0.944 | 0.564 | 100.00%
m4.3 | glmerMod | 1.343 | 1.000 | -1.229 | 0.023 | 0.055 | 0.056 | 0.436 | 68.89%
m4.2 | glmerMod | 1.359 | 1.000 | -1.242 | 0.023 | 5.84e-09 | 5.89e-09 | 4.59e-08 | 49.07%
m4.4 | glmerMod | 1.408 | 1.000 | -1.269 | 0.023 | 1.91e-23 | 1.93e-23 | 1.50e-22 | 42.13%
m4.1 | glm | 1.640 | 1.214 | -1.346 | 0.023 | 5.23e-60 | 5.27e-60 | 4.11e-59 | 0.00%
# Original model is best- should I be skeptical of the performance score of 100%?