You don't need to assign before returning:
real sev_logpdf(real y, real mu, real sigma){
real out;
out = gumbel_lpdf(-y| -mu, sigma);
return out;
}
That can just be return gumbel_lpdf(...).
This prior for p is saying that you expect the
value to be really close to 1 most of the time, but
sometimes very close to 0 and almost never in between:
p ~ beta(.1, .9);
I'd be inclined to go with a more regularizing prior.
It can really help with computation.
It looks like the divergences (I think that's what's
printed in red?) may all be due to numerical issues in
evaluation.
For efficiency, you don't want to keep taking those logs
and exps of the same values inside the loops --- compute them
on the outside and store in a local variable.
You might want to try coding up the Gumbel directly with
a log scale parameter so you don't need the log to exp to log
transform, which can be unstable. And then reducing to the point
where you can
And I'd recommend dropping the interval constraints on
log_sigma and just using the prior as is --- normal(0, 1)
should keep it in (-5, 5) unless there's a ton of data
pulling it out, in which case you probably don't want that
constraint anyway.
Also, there's a log1m_exp(u) which is equal to
log_diff_exp(0, u).
- Bob
> On Aug 26, 2016, at 6:30 PM, Eric Mittman <
mathteach...@gmail.com> wrote:
>
> I am using RStan version
>
> I am building a model for lifetime data that assumes a proportion, p, of units are defective and subject to an additional failure mode. The distribution of X is
>
> Pr(X <= t) = F(t) = 1 - (1 - p * F1(t)) * ( 1 - F2(t))
>
> where X is the failure time for the unit. I assume F1 and F2 are Weibull distributions, and I actually log the data. This implies that log(X) ~ gumbel(-mu, sigma), where mu = log(scale) and sigma = 1/shape of the Weibull.
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
stan-users+...@googlegroups.com.
> To post to this group, send email to
stan-...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
> <mcr_trunc_obs.stan><pairs_stan.png>