From c562419f9433a05fbb9fe5002f7dfc534b1829ba Mon Sep 17 00:00:00 2001 From: Josh Moller-Mara Date: Thu, 24 Jun 2021 15:47:28 -0700 Subject: [PATCH] fix gqs with transformed parameters --- rstan/rstan/R/stanmodel-class.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rstan/rstan/R/stanmodel-class.R b/rstan/rstan/R/stanmodel-class.R index 81a49541f..15253a03e 100644 --- a/rstan/rstan/R/stanmodel-class.R +++ b/rstan/rstan/R/stanmodel-class.R @@ -932,7 +932,8 @@ setMethod("gqs", "stanmodel", p_names <- unique(sub("\\..*$", "", sampler$constrained_param_names(TRUE, FALSE))) all_names <- sampler$constrained_param_names(TRUE, TRUE) some_names <- sampler$constrained_param_names(TRUE, FALSE) - draws_colnames <- sub("\\.", "[", some_names) + # exclude transformed parameters from draws + draws_colnames <- sub("\\.", "[", sampler$constrained_param_names(FALSE, FALSE)) draws_colnames <- gsub("\\.", ",", draws_colnames) draws_colnames[grep("\\[", draws_colnames)] <- paste0(draws_colnames[grep("\\[", draws_colnames)], "]")