Modeling count data with the Bell distribution

library(bellreg)

data(faults)

# ML approach:
mle <- bellreg(nf ~ lroll, data = faults, approach = "mle")
summary(mle)
#> Call:
#> bellreg(formula = nf ~ lroll, data = faults, approach = "mle")
#> 
#> Coefficients:
#>               Estimate     StdErr z.value   p.value    
#> (Intercept) 0.98524996 0.33219431  2.9659  0.003018 ** 
#> lroll       0.00190934 0.00049003  3.8963 9.766e-05 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> logLik = -88.96139   AIC = 181.9228

# Bayesian approach:
bayes <- bellreg(nf ~ lroll, data = faults, approach = "bayes", refresh = FALSE)
summary(bayes)
#> 
#> bellreg(formula = nf ~ lroll, data = faults, approach = "bayes", 
#>     refresh = FALSE)
#> 
#>              mean se_mean    sd  2.5%   25%   50%   75% 97.5%    n_eff  Rhat
#> (Intercept) 0.977   0.007 0.331 0.304 0.757 0.980 1.201 1.620 2326.404 1.002
#> lroll       0.002   0.000 0.000 0.001 0.002 0.002 0.002 0.003 2648.453 1.001
#> 
#> Inference for Stan model: bellreg.
#> 4 chains, each with iter=2000; warmup=1000; thin=1; 
#> post-warmup draws per chain=1000, total post-warmup draws=4000.

log_lik <- loo::extract_log_lik(bayes$fit)
loo::loo(log_lik)
#> Warning: Relative effective sample sizes ('r_eff' argument) not specified.
#> For models fit with MCMC, the reported PSIS effective sample sizes and 
#> MCSE estimates will be over-optimistic.
#> 
#> Computed from 4000 by 32 log-likelihood matrix
#> 
#>          Estimate  SE
#> elpd_loo    -91.0 3.9
#> p_loo         2.0 0.6
#> looic       182.1 7.9
#> ------
#> Monte Carlo SE of elpd_loo is 0.0.
#> 
#> All Pareto k estimates are good (k < 0.5).
#> See help('pareto-k-diagnostic') for details.
loo::waic(log_lik)
#> Warning: 
#> 1 (3.1%) p_waic estimates greater than 0.4. We recommend trying loo instead.
#> 
#> Computed from 4000 by 32 log-likelihood matrix
#> 
#>           Estimate  SE
#> elpd_waic    -91.0 3.9
#> p_waic         1.9 0.6
#> waic         182.0 7.9
#> 
#> 1 (3.1%) p_waic estimates greater than 0.4. We recommend trying loo instead.