From e3eaaf3ccbb0fac314e350253b7dc0bfc4c393b6 Mon Sep 17 00:00:00 2001 From: Sebastian Funk Date: Wed, 22 Nov 2023 14:43:52 +0000 Subject: [PATCH] loop over all parameters --- inst/stan/functions/delays.stan | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/inst/stan/functions/delays.stan b/inst/stan/functions/delays.stan index 4e7f3878b..aefeacbfa 100644 --- a/inst/stan/functions/delays.stan +++ b/inst/stan/functions/delays.stan @@ -105,7 +105,12 @@ void delays_lp(vector delay_params, } vector normal_lb_rng(vector mu, vector sigma, vector lb) { - real p = normal_cdf(lb, mu, sigma); // cdf for bounds + int len = num_elements(mu); + vector[len] ret; + for (i in 1:len) { + real p = normal_cdf(lb[i], mu[i], sigma[i]); // cdf for bounds real u = uniform_rng(p, 1); - return (sigma * inv_Phi(u)) + mu; // inverse cdf for value + ret[i] = (sigma[i] * inv_Phi(u)) + mu[i]; // inverse cdf for value + } + return ret; }