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.98524443 0.33219412  2.9659  0.003018 ** 
#> lroll       0.00190935 0.00049003  3.8964 9.765e-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.991   0.007 0.331 0.329 0.767 1.000 1.212 1.625 2103.403 1.000
#> lroll       0.002   0.000 0.000 0.001 0.002 0.002 0.002 0.003 2394.623 0.999
#> 
#> 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)
#> 
#> 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
#> ------
#> MCSE of elpd_loo is 0.0.
#> MCSE and ESS estimates assume independent draws (r_eff=1).
#> 
#> All Pareto k estimates are good (k < 0.7).
#> 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.