From a789ea2ae74ae371476f0e1f035226d07a429a0b Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 28 Mar 2025 07:11:13 +0100 Subject: Make parent model selection more robust In case one of the fits failed, the corresponding entry in `aic_parent` is `NA`, so we need to tell the `min()` function to ignore `NA` values instead of returning and empty result. --- inst/rmarkdown/templates/hierarchical_kinetics/skeleton/skeleton.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/rmarkdown/templates/hierarchical_kinetics/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/hierarchical_kinetics/skeleton/skeleton.Rmd index a77908cb..f0692b4c 100644 --- a/inst/rmarkdown/templates/hierarchical_kinetics/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/hierarchical_kinetics/skeleton/skeleton.Rmd @@ -122,7 +122,7 @@ From the refined fits, the most suitable model is selected using the AIC. ```{r parent-best, dependson = "parent-mhmkin"} aic_parent <- AIC(parent_mhmkin_refined) -min_aic <- which(aic_parent == min(aic_parent), arr.ind = TRUE) +min_aic <- which(aic_parent == min(aic_parent, na.rm = TRUE), arr.ind = TRUE) best_degmod_parent <- rownames(aic_parent)[min_aic[1]] best_errmod_parent <- colnames(aic_parent)[min_aic[2]] anova(parent_mhmkin_refined) |> kable(digits = 1) -- cgit v1.2.1