
Bayesian information criterion, vectorised (Geron Ch 8, morie.fn hmbic)
Source:R/geron_ml_native.R
morie_geron_bic.RdBIC = -2 log L + k log n. best_index is 0-based.
Examples
morie_geron_bic(log_lik = c(1, 2, 3, 4, 5, 6, 7, 8), k = 5L, n = 5L)
#> $bic
#> [1] 6.04718956 4.04718956 2.04718956 0.04718956 -1.95281044 -3.95281044
#> [7] -5.95281044 -7.95281044
#>
#> $delta
#> [1] 14 12 10 8 6 4 2 0
#>
#> $weights
#> [1] 0.0005766128 0.0015673960 0.0042606241 0.0115815771 0.0314819905
#> [6] 0.0855769227 0.2326221940 0.6323326828
#>
#> $best_index
#> [1] 7
#>
#> $penalty
#> [1] 1.609438
#>
#> $estimate
#> [1] -7.95281
#>
#> $n
#> [1] 5
#>
#> $method
#> [1] "Bayesian information criterion (BIC = -2 log L + k log n)"
#>