drizopoulos / GLMMadaptive

GLMMs with adaptive Gaussian quadrature
https://drizopoulos.github.io/GLMMadaptive/
59 stars 14 forks source link

large difference in SE of marginal coefs in Rv3.5.0 vs Rv3.6.1 #23

Closed jessiemutz closed 4 years ago

jessiemutz commented 4 years ago

Hello -- I recently reran some analyses that were originally performed in Rv3.5.0 in Rv3.6.1. The marginal coefficient estimates of the models were similar, but the SEs of the marginal coefficient estimates were larger -- nearly twice as large in some cases -- when run in v3.6.1. I see from the Changelog that some changes were made to the marginal_coefs() function for faster implementation -- would this have affected the SEs? If so, which version of the function is more accurate?

Here is the structure and output of one of the models in question: MM.egg50 <- mixed_model(fixed = Egg.egg ~ Dens.juncta.leaf + Dens.juncta.plant + Dens.patch.50 + Plant.biomass + Patch.50.biomass + Day.of.year, random = ~1|Cohort.ID, data = datsc, family = binomial(), control = list(optim_method = "SANN"), nAGQ = 30)

output from summary() command is identical

output from Rv3.5.0

MM.egg50.mc <- marginal_coefs(MM.egg50, std_errors = TRUE) MM.egg50.mc Value Std.Err z-value p-value (Intercept) 3.8304 0.7230 5.2980 < 1e-04 Dens.juncta.leaf 0.6343 0.1733 3.6592 0.00025297 Dens.juncta.plant -2.3122 0.5102 -4.5317 < 1e-04 Dens.patch.50 4.0207 1.0459 3.8443 0.00012091 Plant.biomass -0.4582 0.2464 -1.8597 0.06292951 Patch.50.biomass 0.6686 0.2934 2.2789 0.02267285 Day.of.year -1.7861 0.2829 -6.3135 < 1e-04

output from Rv3.6.1

MM.egg50.mc <- marginal_coefs(MM.egg50, std_errors = TRUE) MM.egg50.mc Estimate Std.Err z-value p-value (Intercept) 3.8504 0.9785 3.9350 < 1e-04 Dens.juncta.leaf 0.6423 0.3425 1.8750 0.0607878 Dens.juncta.plant -2.3245 0.7137 -3.2570 0.0011259 Dens.patch.50 4.0205 1.3579 2.9607 0.0030695 Plant.biomass -0.4663 0.4778 -0.9760 0.3290571 Patch.50.biomass 0.6710 0.5041 1.3311 0.1831415 Day.of.year -1.8071 0.4642 -3.8930 < 1e-04

Thanks, Jessie

drizopoulos commented 4 years ago

Indeed the current version is faster but also it does a more correct calculation of the standard errors than the previous version.