easystats / insight

:crystal_ball: Easy access to model information for various model objects
https://easystats.github.io/insight/
GNU General Public License v3.0
399 stars 39 forks source link

`get_variance_distribution()` returns `NULL` for `brms` negative binomial model #776

Closed MCMaurer closed 2 months ago

MCMaurer commented 1 year ago
library(brms)
library(insight)

set.seed(12901)
d <- data.frame(resp = rnbinom(100, 23, 0.4))

m1 <- brm(
  resp ~ 1,
  data = d,
  family = negbinomial(),
  iter = 10000, warmup = 3000,
  chains = 4, cores = 4,
  init = "random", seed = 1029
)

# returns NULL
get_variance(m1)

# returns NULL
get_variance_distribution(m1)

sessionInfo() results:

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.6.3

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] insight_0.14.1 brms_2.17.0    Rcpp_1.0.9    

loaded via a namespace (and not attached):
  [1] nlme_3.1-152         matrixStats_0.62.0   xts_0.12.1           threejs_0.3.3        rstan_2.26.11       
  [6] tensorA_0.36.2       tools_4.2.1          backports_1.4.1      utf8_1.2.2           R6_2.5.1            
 [11] DT_0.22              mgcv_1.8-36          projpred_2.0.2       DBI_1.1.1            colorspace_2.0-3    
 [16] tidyselect_1.1.2     gridExtra_2.3        prettyunits_1.1.1    processx_3.5.3       Brobdingnag_1.2-7   
 [21] emmeans_1.6.1        curl_4.3.2           compiler_4.2.1       cli_3.3.0            shinyjs_2.1.0       
 [26] sandwich_3.0-1       colourpicker_1.1.1   posterior_1.2.1      scales_1.2.1         dygraphs_1.1.1.6    
 [31] checkmate_2.1.0      mvtnorm_1.1-3        ggridges_0.5.3       callr_3.7.0          stringr_1.4.0       
 [36] digest_0.6.29        StanHeaders_2.26.11  minqa_1.2.4          base64enc_0.1-3      pkgconfig_2.0.3     
 [41] htmltools_0.5.2      lme4_1.1-29          fastmap_1.1.0        htmlwidgets_1.5.4    rlang_1.0.4         
 [46] rstudioapi_0.13      shiny_1.7.1          farver_2.1.1         generics_0.1.3       zoo_1.8-10          
 [51] jsonlite_1.8.0       crosstalk_1.2.0      gtools_3.9.2         dplyr_1.0.9          distributional_0.3.0
 [56] inline_0.3.19        magrittr_2.0.3       loo_2.5.1            bayesplot_1.9.0      Matrix_1.3-4        
 [61] munsell_0.5.0        fansi_1.0.3          abind_1.4-5          lifecycle_1.0.1      stringi_1.7.8       
 [66] multcomp_1.4-17      MASS_7.3-54          pkgbuild_1.3.1       plyr_1.8.7           grid_4.2.1          
 [71] parallel_4.2.1       promises_1.2.0.1     crayon_1.5.1         miniUI_0.1.1.1       lattice_0.20-44     
 [76] splines_4.2.1        ps_1.7.0             pillar_1.8.1         igraph_1.3.1         boot_1.3-28         
 [81] markdown_1.1         estimability_1.3     shinystan_2.6.0      reshape2_1.4.4       codetools_0.2-18    
 [86] stats4_4.2.1         rstantools_2.2.0     glue_1.6.2           V8_4.1.0             RcppParallel_5.1.5  
 [91] nloptr_2.0.2         vctrs_0.4.1          httpuv_1.6.5         gtable_0.3.0         purrr_0.3.4         
 [96] assertthat_0.2.1     ggplot2_3.3.6        mime_0.12            xtable_1.8-4         coda_0.19-4         
[101] later_1.3.0          survival_3.2-11      tibble_3.1.8         shinythemes_1.2.0    gamm4_0.2-6         
[106] TH.data_1.0-10       ellipsis_0.3.2       bridgesampling_1.1-2
strengejacke commented 2 months ago

That's not a mixed model. get_variance() only applies to mixed models.