Skip to content

Commit

Permalink
feat!: update downstream code for reporting model fits #42
Browse files Browse the repository at this point in the history
where replace values with NA for SE_calc, singularity, and CI_calc where model did not converge (makes no sense to report if model didn't fit)
  • Loading branch information
egouldo committed Sep 4, 2024
1 parent 065154d commit 6354099
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion supp_mat/SM3_ExplainingDeviation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,10 @@ Zr_singularity_convergence <-
convergence,
singularity) %>%
mutate(CI_calc = FALSE)}) %>%
rowwise() %>%
mutate(across(ends_with("_calc"),
~ replace_na(.x, TRUE)))
~ replace_na(.x, TRUE))) %>%
mutate(across(c(SE_calc, CI_calc, singularity), ~ ifelse(is_false(convergence), NA, .x)))
# ----- new code showing ALL model fits not just bad fits
Expand Down Expand Up @@ -716,6 +718,7 @@ yi_convergence_singularity <-
rowwise() %>%
mutate(CI_calc = any(CI_high_calc, CI_low_calc), .keep = "unused") %>%
rename_with(~ stringr::str_remove(.x, "_NA")) %>%
mutate(across(c(SE_calc, CI_calc, singularity), ~ ifelse(is_false(convergence), NA, .x))) %>%
ungroup()
Expand Down Expand Up @@ -1071,6 +1074,7 @@ patchwork::wrap_plots(yi_sorensen_plots,heights = 4, byrow = TRUE) +
#| message: false
yi_singularity_convergence_sorensen_mixed_mod %>%
mutate(across(c(SE_calc, CI_calc, singularity), ~ ifelse(is_false(convergence), NA, .x))) %>%
select(-model_params) %>%
group_by(model_name) %>%
gt::gt(rowname_col = "dataset") %>%
Expand Down

0 comments on commit 6354099

Please sign in to comment.