From dbe69ddaf5c60d63213aee1edb04ff679c18b4cb Mon Sep 17 00:00:00 2001 From: Aki Vehtari Date: Wed, 15 Nov 2017 16:07:40 -0500 Subject: [PATCH] bug fix rng k->0 --- demos_rstan/gpareto_functions/gpareto.stan | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/demos_rstan/gpareto_functions/gpareto.stan b/demos_rstan/gpareto_functions/gpareto.stan index 8922998..5d56e4c 100644 --- a/demos_rstan/gpareto_functions/gpareto.stan +++ b/demos_rstan/gpareto_functions/gpareto.stan @@ -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 { @@ -66,8 +66,7 @@ data { vector[Nt] yt; } transformed data { - real ymax; - ymax = max(y); + real ymax = max(y); } parameters { real sigma;