Skip to content

Commit

Permalink
loop over all parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Nov 22, 2023
1 parent ff5007b commit e3eaaf3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions inst/stan/functions/delays.stan
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit e3eaaf3

Please sign in to comment.