Sampler stops after warmup: Weibull model

55 views
Skip to first unread message

Andrew Rosenberg

unread,
Jul 19, 2016, 11:31:28 AM7/19/16
to Stan users mailing list
Hello All,

I am working on a zero-inflated Weibull model. When I run the model with fake data, I am able to recover the proper coefficients by using both variational bayes and regular sampling. However, when I move to use my actual data, VB works and the PP checks look good, but the sampler stops immediately after warmup, even with very few numerical problems. In order to troubleshoot, I have simplified by using 100 warmup and 100 iter with only an intercept in the model. I have attached the model code, and this is the (standard, and quite embarrassing) numerical problem message I get:

Chain 1, Iteration:  1 / 100 [  1%]  (Warmup)
Chain 1, Iteration: 10 / 100 [ 10%]  (Warmup)
Chain 1, Iteration: 20 / 100 [ 20%]  (Warmup)
Chain 1, Iteration: 30 / 100 [ 30%]  (Warmup)
Chain 1, Iteration: 40 / 100 [ 40%]  (Warmup)
Chain 1, Iteration: 50 / 100 [ 50%]  (Warmup)
Chain 1, Iteration: 60 / 100 [ 60%]  (Warmup)
Chain 1, Iteration: 70 / 100 [ 70%]  (Warmup)
Chain 1, Iteration: 80 / 100 [ 80%]  (Warmup)
Chain 1, Iteration: 90 / 100 [ 90%]  (Warmup)
Chain 1, Iteration: 100 / 100 [100%]  (Warmup)
 Elapsed Time: 22.9021 seconds (Warm-up)
               2e-06 seconds (Sampling)
               22.9021 seconds (Total)

The following numerical problems occured the indicated number of times after warmup on chain 1
                                                                                 count
Exception thrown at line 32: weibull_log: Shape parameter is 0, but must be > 0!    10
When a numerical problem occurs, the Metropolis proposal gets rejected.
However, by design Metropolis proposals sometimes get rejected even when there are no numerical problems.
Thus, if the number in the 'count' column is small, do not ask about this message on stan-users.


Also, here is my R session info:
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.5 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] splines   stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] fitdistrplus_1.0-7   survival_2.39-5      MASS_7.3-45         
 [4] VGAM_1.0-2           shinystan_2.2.0      shiny_0.13.2        
 [7] rstan_2.10.1         StanHeaders_2.10.0-2 ggplot2_2.1.0       
[10] data.table_1.9.6


I'm sorry if this is a ridiculous issue!

Best,
Drew
test_weibull_hurdle.stan

Krzysztof Sakrejda

unread,
Jul 19, 2016, 11:45:16 AM7/19/16
to Stan users mailing list
That output doesn't match up with your words for me.  It looks like it completes fine, could you post hte command you are running? Krzysztof

Andrew Rosenberg

unread,
Jul 19, 2016, 11:56:25 AM7/19/16
to Stan users mailing list
Sure, no problem. I'm running these commands:

sm <- stan_model("~/Dissertation/stan_models/test_weibull_hurdle.stan")
sf <- sampling(sm, data = dl, chains = 1, iter = 100, warmup = 100,  include = FALSE)

Krzysztof Sakrejda

unread,
Jul 19, 2016, 12:21:22 PM7/19/16
to Stan users mailing list


On Tuesday, July 19, 2016 at 11:56:25 AM UTC-4, Andrew Rosenberg wrote:
Sure, no problem. I'm running these commands:

sm <- stan_model("~/Dissertation/stan_models/test_weibull_hurdle.stan")
sf <- sampling(sm, data = dl, chains = 1, iter = 100, warmup = 100,  include = FALSE)

So iter is the total number of iterations and the number of sampling iterations (post-warmup) is iter-warmup, so you have zero sampling iterations and rstan is behaving as requested here. It's a little confusing, but raise iter to 200 to ge tthe effect you want. K

Andrew Rosenberg

unread,
Jul 19, 2016, 12:31:02 PM7/19/16
to Stan users mailing list
embarrassing for me... 

Thank you so much! It was driving me insane!

Krzysztof Sakrejda

unread,
Jul 19, 2016, 12:36:49 PM7/19/16
to Stan users mailing list
No worries, we've all done it and this particular one should have a flashing warning sign... so the cue for me was that it printed timings, including timing for sampling (which was listed as being very fast). K
Reply all
Reply to author
Forward
0 new messages