Skip to content

Commit

Permalink
Merge pull request #29 from jgabry/loo-package-compatibility
Browse files Browse the repository at this point in the history
Compatibility with upcoming loo package release
  • Loading branch information
ericward-noaa authored Feb 5, 2024
2 parents 87765b6 + f673db3 commit 4c684c6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/find_regimes.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ find_regimes <- function(y,
chains = chains, ...
)
looic <- loo.bayesdfa(fit)
loo_bad <- loo::pareto_k_table(looic)["(0.7, 1]", "Count"]
loo_very_bad <- loo::pareto_k_table(looic)["(1, Inf)", "Count"]
k_table <- loo::pareto_k_table(looic)
if (nrow(k_table) == 4) {
loo_bad <- k_table["(0.7, 1]", "Count"]
loo_very_bad <- k_table["(1, Inf)", "Count"]
} else {
loo_bad <- k_table[2, "Count"]
loo_very_bad <- k_table[3, "Count"]
}
df$looic[which(df$regimes == regime)] <- looic$estimates["looic", "Estimate"]

if (fit$looic < best_loo) {
Expand Down

0 comments on commit 4c684c6

Please sign in to comment.