From 3974b443761ef9def3d4914b64e48cf6b0f447a6 Mon Sep 17 00:00:00 2001 From: fweber144 Date: Mon, 26 Jun 2023 21:06:47 +0200 Subject: [PATCH] Add a warning for issue #323 to `project()`. --- R/project.R | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/R/project.R b/R/project.R index ee8505433..99f65283e 100644 --- a/R/project.R +++ b/R/project.R @@ -252,6 +252,18 @@ project <- function(object, nterms = NULL, solution_terms = NULL, nclusters <- 1 } + nterms_max <- max(nterms) + nterms_all <- count_terms_in_formula(refmodel$formula) - 1L + if (nterms_max == nterms_all && + formula_contains_group_terms(refmodel$formula) && + (refmodel$family$family == "gaussian" || refmodel$family$for_latent)) { + warning( + "In case of the Gaussian family (also in case of the latent projection) ", + "and multilevel terms, the projection onto the full model can be ", + "instable and even lead to an error, see GitHub issue #323." + ) + } + ## get the clustering or thinning if (refit_prj) { p_ref <- get_refdist(refmodel, ndraws = ndraws, nclusters = nclusters)