I am a beginner for RStan and I am trying to fit gamma and Weibull distributions to some failure data. When fitting the models they produce following error.

[1] "The following numerical problems occured the indicated number of times after warmup on chain 1"

count

Exception thrown at line 18: weibull_log: Shape parameter is 0, but must be > 0! 7

I get similar error messages for all the chains (4 chains) and for the gamma distributions.

Here is my attempt to fit the Weibull model.

```
library (rstan)
modelString = "data {
int<lower=0> J; // number of observations
real y[J]; // failure in hours
}
parameters {
real<lower=0> alpha; // shape
real<lower=0> sigma; // scale
}
model {
//define priors of alpha and beta
alpha ~ uniform(0, 20);
sigma ~ inv_gamma(0.1, 0.1);
//Likelihood of the data
y ~ weibull(alpha, sigma);
}"
mod_weib <- stan_model(model_code = modelString)
failure_data <- list (J = 88,
y = rep (c (8, 16, 32, 40, 56, 60, 64, 72, 80, 96, 104, 108, 112, 114,
120, 128, 136, 152, 156, 160, 168, 176, 184, 194, 208, 216,
224, 232, 240, 246, 256, 264, 272, 280, 288, 304, 308, 328,
340, 352, 358, 360, 384, 392, 400, 424, 438, 448, 464, 480,
536, 552, 576, 608, 656, 716), times = c (1, 4, 2, 4, 3, 1, 1,
5, 4, 2, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 5, 1, 3, 1, 2, 1, 4, 1,
1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1))
)
fit_weib <- sampling(mod_weib, data = failure_data, chains = 4)
fit_weib
```

Any suggestions to solve this problem will be highly appreciated.

Thank you in advance!