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       nbinom 538.9290   0.000000 9.415687e-01 544.1393   0.000000
#> 2         geom 544.4884   5.559391 5.843130e-02 547.0936   2.954221
#> 3         pois 937.8823 398.953300 2.199093e-87 940.4875 396.348130
#>           wBIC
#> 1 8.141357e-01
#> 2 1.858643e-01
#> 3 6.995101e-87