Skip to content

Commit

Permalink
Add a warning for issue stan-dev#323 to project().
Browse files Browse the repository at this point in the history
  • Loading branch information
fweber144 committed Jun 27, 2023
1 parent be7d3d7 commit 3974b44
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions R/project.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3974b44

Please sign in to comment.