Skip to content

Commit

Permalink
Compatibility with next loo package release
Browse files Browse the repository at this point in the history
  • Loading branch information
jgabry committed Feb 1, 2024
1 parent 87765b6 commit 26457e4
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 (utils::packageVersion("loo") <= "2.6.0") {
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 26457e4

Please sign in to comment.