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.98523702 0.33219497  2.9658  0.003019 ** 
#> lroll       0.00190935 0.00049004  3.8963 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.993   0.007 0.326 0.348 0.776 0.996 1.211 1.638 2407.233    1
#> lroll       0.002   0.000 0.000 0.001 0.002 0.002 0.002 0.003 2666.719    1
#> 
#> 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: Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.
#> 
#> Computed from 4000 by 32 log-likelihood matrix.
#> 
#>          Estimate   SE
#> elpd_loo   -201.6 34.4
#> p_loo        60.0 18.9
#> looic       403.1 68.8
#> ------
#> MCSE of elpd_loo is NA.
#> MCSE and ESS estimates assume independent draws (r_eff=1).
#> 
#> Pareto k diagnostic values:
#>                          Count Pct.    Min. ESS
#> (-Inf, 0.7]   (good)     26    81.2%   394     
#>    (0.7, 1]   (bad)       4    12.5%   <NA>    
#>    (1, Inf)   (very bad)  2     6.2%   <NA>    
#> See help('pareto-k-diagnostic') for details.
loo::waic(log_lik)
#> Warning: 
#> 21 (65.6%) p_waic estimates greater than 0.4. We recommend trying loo instead.
#> 
#> Computed from 4000 by 32 log-likelihood matrix.
#> 
#>           Estimate   SE
#> elpd_waic   -202.6 35.7
#> p_waic        61.0 20.2
#> waic         405.1 71.4
#> 
#> 21 (65.6%) p_waic estimates greater than 0.4. We recommend trying loo instead.