m-clark/mixedup

Some options drop term names in extract fixed effects.

m-clark opened this issue · 1 comments

While recently discovered and fixed for merMod when CI is not wanted, it appears to happen for exponentiate and other classes due to dplyr bug/philosophy where rownames are dropped even if the class of the object is not changed (i.e. is still a data.frame and not a tibble). This is because mutate, filter, etc. will as.data.frame(tbl_df(...)) even though this is not required or requested for the operation, and there is no argument to change the behavior.

tmb_2 = glmmTMB::glmmTMB(Reaction ~ Days + (Days|Subject), lme4::sleepstudy)
extract_fixed_effects(tmb_2, exponentiate = T)

# A tibble: 2 x 7
#  term     value       se     z p_value lower_2.5 upper_97.5
#  <chr>    <dbl>    <dbl> <dbl>   <dbl>     <dbl>      <dbl>
# 1 1     1.53e109 1.01e110 37.9        0  3.46e103   6.75e114
# 2 2     3.51e  4 5.28e  4  6.97       0  1.85e  3   6.68e  5

Updated and passing tests. Closing for now.

tmb_2 = glmmTMB::glmmTMB(Reaction ~ Days + (Days|Subject), lme4::sleepstudy)
mixedup::extract_fixed_effects(tmb_2, exponentiate = T)
#> # A tibble: 2 x 7
#>   term         value       se     z p_value lower_2.5 upper_97.5
#>   <chr>        <dbl>    <dbl> <dbl>   <dbl>     <dbl>      <dbl>
#> 1 Intercept 1.53e109 1.01e110 37.9        0  3.46e103   6.75e114
#> 2 Days      3.51e  4 5.28e  4  6.97       0  1.85e  3   6.68e  5