Skip to content

Commit

Permalink
add a contraint on the size of the shape parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
n8thangreen committed Sep 15, 2024
1 parent b977852 commit 71f2e58
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/stan_code_blocks.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ make_latent_model_code <- function(model, id = 1L) {
vector[N_{id}] lambda_{id};\n")

scode$trans_params_main <-
glue("lambda_{id} = exp(lp_{id});\n")
glue("lambda_{id} = exp(lp_{id});\n",
"if (lambda_{id} > 100) {{ // arbitrarily choose a reasonable upper bound\n",
" lambda_{id} = 100;\n",
"}\n")

scode$model <-
glue("shape_{id} ~ gamma(a_shape_{id}, b_shape_{id});\n")
Expand Down

0 comments on commit 71f2e58

Please sign in to comment.