Skip to contents

This is a helper function for creating a model comparison <data.frame> primarily for use in the superspreading vignettes. It is designed specifically for handling fitdistrplus::fitdist() output and not a generalised function. See bbmle::ICtab() for a more general use function to create information criteria tables.

Usage

ic_tbl(..., sort_by = c("AIC", "BIC", "none"))

Arguments

...

dots One or more model fit results from fitdistrplus::fitdist().

sort_by

A character string specifying which information criterion to order the table by, either "AIC" (default), "BIC", or "none" (i.e. no ordering).

Value

A <data.frame>.

Examples

if (requireNamespace("fitdistrplus", quietly = TRUE)) {
  cases <- rnbinom(n = 100, mu = 5, size = 0.7)
  pois_fit <- fitdistrplus::fitdist(data = cases, distr = "pois")
  geom_fit <- fitdistrplus::fitdist(data = cases, distr = "geom")
  nbinom_fit <- fitdistrplus::fitdist(data = cases, distr = "nbinom")
  ic_tbl(pois_fit, geom_fit, nbinom_fit)
}
#>   distribution      AIC   DeltaAIC         wAIC      BIC   DeltaBIC
#> 1         geom 546.6447   0.000000 6.265959e-01 549.2499   0.000000
#> 2       nbinom 547.6800   1.035281 3.734041e-01 552.8903   3.640451
#> 3         pois 849.8365 303.191794 9.114358e-67 852.4417 303.191794
#>           wBIC
#> 1 8.605932e-01
#> 2 1.394068e-01
#> 3 1.251804e-66