Skip to content

Commit

Permalink
bug fix rng k->0
Browse files Browse the repository at this point in the history
  • Loading branch information
avehtari committed Nov 15, 2017
1 parent b04c010 commit dbe69dd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions demos_rstan/gpareto_functions/gpareto.stan
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ functions {
if (sigma<=0)
reject("sigma<=0; found sigma =", sigma)
if (fabs(k) > 1e-15)
return (ymin + (pow(uniform_rng(0,1),-k)-1)*sigma/k);
return ymin + (uniform_rng(0,1)^-k -1) * sigma / k;
else
return (ymin - sigma*log(1/uniform_rng(0,1)-1)); // limit k->0
return ymin - sigma*log(uniform_rng(0,1)); // limit k->0
}
}
data {
Expand All @@ -66,8 +66,7 @@ data {
vector<lower=ymin>[Nt] yt;
}
transformed data {
real ymax;
ymax = max(y);
real ymax = max(y);
}
parameters {
real<lower=0> sigma;
Expand Down

0 comments on commit dbe69dd

Please sign in to comment.