Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stability issues in the numerical integral solver #34

Closed
3 of 5 tasks
seabbs opened this issue Sep 4, 2024 · 18 comments · Fixed by #64
Closed
3 of 5 tasks

Stability issues in the numerical integral solver #34

seabbs opened this issue Sep 4, 2024 · 18 comments · Fixed by #64
Labels
bug Something isn't working

Comments

@seabbs
Copy link
Contributor

seabbs commented Sep 4, 2024

In the fitting delay distributions with stan I am seeing numerical instability and with more complex models (i.e. varying windows etc) I am seeing complete failures.

None of these issues are apparent outside of stan which indicates it is a auto-diff issues. Some potential solutions to investigate:

  • Explore why d is being passed via theta to primary_censored_integrand #31
  • Is performance improved solving as a ODE (some stan threads hint at this but it is unclear if they are out of date)
  • Can we identify when the integral solver is having problems
  • Are the issues due to a incorrect specification in the code?
  • Once identified can be isolate any of the failure modes to prevent them causing errors?
@seabbs seabbs added the bug Something isn't working label Sep 4, 2024
@seabbs
Copy link
Contributor Author

seabbs commented Sep 4, 2024

This may have some useful guidance: https://mc-stan.org/docs/stan-users-guide/one-dimensional-integrals.html

From skimming it looks like the support for xc (i.e high precious distance) may be very helpful.

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

I tried implementing xc as suggested as went from having quadrature failures due to potential singularities to having the integral not be numerically solvable :

if (x > (pwindow - 0.1)) {

I also moved d from being a parameter to being data (this had limited impact)

Giving up on that angle and instead investigating reparameterising the integral in terms of the delay vs the censoring window

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

I have now also explored solving the integral between min delay and max delay instead of over the primary event window. With this approach I find that without using xc I have tsinh based failures in the integral solver and with xc I have error estimate of the integral exceeds the tolerance for ever regardless of the tolerance.

See:

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

It looks like one of the main causes of failure s very large values of mu or very small values of sigma when initialising. Ideally integrate_1d would reject on error but it looks like it instead just errors and causes things to crash. If we had a try catch or similar here that would be perfect but as far as I am aware we don't

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

Adding safety catches and dealing with some weird behaviour where bounds can be negative (despite being set not to be) I have got this to reliably initialise. The remaining challenge is that during sampling chains are very likely to family. See below for an example.

Chain 12 Exception: Exception: Exception: Exception: Error in function tanh_sinh<double>::integrate: The tanh_sinh quadrature evaluated your function at a singular point and got 0.012922205435562894. Integration bounds were automatically narrowed, but the integral was found to be increasing at the new endpoint.  Please check your function, and consider providing a 2-argument functor. (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 221, column 2, included from
Chain 12 '/tmp/RtmptDpbv3/model-1567792c821e0b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 262, column 2, included from
Chain 12 '/tmp/RtmptDpbv3/model-1567792c821e0b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 306, column 2, included from
Chain 12 '/tmp/RtmptDpbv3/model-1567792c821e0b.stan', line 3, column 4) (in '/tmp/RtmptDpbv3/model-1567792c821e0b.stan', line 32, column 6 to line 36, column 8)
Warning: Chain 12 finished unexpectedly!

Warning: 11 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 23.2 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2133.55 -2133.24 1.00 0.70 -2135.63 -2132.59 1.01      332      640
    mu        1.53     1.53 0.05 0.05     1.45     1.61 1.01      365      434
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.01      349      372

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

Current progress on this from a large run of 256 chains (243 failed all part way through sampling (i.e post warmup and initialisation).

Chain 252 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 252 Exception: Exception: Exception: Exception: Error in function tanh_sinh<double>::integrate: The tanh_sinh quadrature evaluated your function at a singular point and got -0.038716888888388652. Integration bounds were automatically narrowed, but the integral was found to be increasing at the new endpoint.  Please check your function, and consider providing a 2-argument functor. (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 207, column 2, included from
Chain 252 '/tmp/RtmptDpbv3/model-15677938051017.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 248, column 2, included from
Chain 252 '/tmp/RtmptDpbv3/model-15677938051017.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 295, column 2, included from
Chain 252 '/tmp/RtmptDpbv3/model-15677938051017.stan', line 3, column 4) (in '/tmp/RtmptDpbv3/model-15677938051017.stan', line 32, column 6 to line 36, column 8)
Warning: Chain 252 finished unexpectedly!

Warning: 243 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 95.9 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2133.54 -2133.23 1.01 0.73 -2135.58 -2132.58 1.00     5046     6124
    mu        1.53     1.53 0.05 0.05     1.45     1.62 1.00     4119     4642
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.00     4084     5054

Current work on this is on: [explore-int-as-delay](https://github.com/epinowcast/primarycensoreddist/tree/explore-int-as-delay)

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

Dropping the integration relative tolerance to 1e-2 (from 1e-6) I see a marked improvement in chain survival 47 failures out of 256 chains) with little impact on estimates (in this example)

Warning: 47 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 225.1 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2133.56 -2133.24 1.03 0.73 -2135.60 -2132.59 1.00    75297    86538
    mu        1.53     1.53 0.05 0.05     1.46     1.62 1.00    66154    68789
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.00    64843    73115

Dropping it still further to 1e-1 all chains near instantly failed (i.e. in warmup).

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

Bumping up to 600 chains I see:

Warning: 151 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 496.7 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2133.54 -2133.23 1.01 0.73 -2135.57 -2132.58 1.00   168061   197524
    mu        1.53     1.53 0.05 0.05     1.46     1.62 1.00   139965   147995
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.00   136929   162243

Adding

  if (d_adj <= 1e-3) {
    return(0);
  }

and repeating with 600 chains I see:

Warning: 146 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 503.1 seconds.

i.e. 25% failure rate roughly for both

No apparent difference between estimates from both runs.

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

Increasing coverage that uses the xc as follows (from 0.2):

  if (x > (d - 0.3 * pwindow)) {
    d_adj = d - xc;
    ppoint = xc;
  } else if (x < 0.3 * pwindow) {
    d_adj = -xc;
    ppoint = d - d_adj;
  } else {
    d_adj = x;
    ppoint = d - d_adj;
  }

I see (again over 600 chains):

Warning: 135 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 660.2 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2133.55 -2133.24 1.02 0.73 -2135.58 -2132.58 1.00   175257   209306
    mu        1.53     1.53 0.05 0.05     1.46     1.62 1.00   146999   155267
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.00   144171   168075

which drops it down to a 22.5% failure rate.

I'm a bit worried about this approach to detecting boundaries as the integral is not always going to be over pwindow length (as the lower bound is max(d - pwindow, 1e-8)) unfortunately it isn't trivial to pass in the actual length of the interval without annoying requirements on the user (as must be "data").

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

Repeating (again 600 chains) but dropping the boundary to 0.1*pwindow I see the following:

Warning: 160 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 491.6 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2133.55 -2133.24 1.01 0.73 -2135.57 -2132.58 1.00   163380   193591
    mu        1.53     1.53 0.05 0.05     1.46     1.62 1.00   136422   145670
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.00   134611   156760 

which is a 26% failure rate so tuning this is making some difference but not a huge amount.

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

Removing truncation adjustment (so obviously incorrect estimates):

Warning: 33 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 318.3 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2217.49 -2217.18 1.00 0.71 -2219.48 -2216.54 1.00   266131   339212
    mu        1.30     1.30 0.02 0.02     1.27     1.33 1.00   517717   400323
    sigma     0.58     0.58 0.01 0.01     0.55     0.60 1.00   416900   367668

which is a 5.5% failure rate.

This massive drop does suggest the interaction between the cdf and the obs time cdf is a major problem (which does of course make sense).

You still see the same thing when changing the return to return exp(log_cdf + log_primary_pdf); which makes sense

For interest I tried changing the return expression to not be on the log scale and that just causes everything to fail

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

Things are now stable enough at initialisation that we can drop truncation of mu (i.e see this 16 chain run with all failures post init).

Something to note here is that failures are coming from both the upper (2) and lower bound (1) calls. I've repeated this a few times and it just seems random.

Follow us tasks are to start permuting the dataset to see what impact that has and to try and understand what causes singularities (i.e infs) in the integral.

Chain 3 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 4 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 5 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 6 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 7 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 8 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 9 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 10 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 11 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 13 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 14 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 12 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 15 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 16 Iteration:  100 / 2000 [  5%]  (Warmup) 
Chain 1 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 3 Exception: Exception: Exception: Exception: Error in function tanh_sinh<double>::integrate: The tanh_sinh quadrature evaluated your function at a singular point and got -inf. Please narrow the bounds of integration or check your function for singularities. (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 205, column 2, included from
Chain 3 '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 246, column 2, included from
Chain 3 '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 290, column 2, included from
Chain 3 '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 3, column 4) (in '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 32, column 6 to line 36, column 8)
Warning: Chain 3 finished unexpectedly!

Chain 2 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 4 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 5 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 7 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 6 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 8 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 9 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 2 Exception: Exception: Exception: Exception: Error in function tanh_sinh<double>::integrate: The tanh_sinh quadrature evaluated your function at a singular point and got -inf. Please narrow the bounds of integration or check your function for singularities. (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 205, column 2, included from
Chain 2 '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 246, column 2, included from
Chain 2 '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 293, column 2, included from
Chain 2 '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 3, column 4) (in '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 32, column 6 to line 36, column 8)
Warning: Chain 2 finished unexpectedly!

Chain 10 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 11 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 14 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 12 Exception: Exception: Exception: Exception: Error in function tanh_sinh<double>::integrate: The tanh_sinh quadrature evaluated your function at a singular point and got -0.015744452040537531. Integration bounds were automatically narrowed, but the integral was found to be increasing at the new endpoint.  Please check your function, and consider providing a 2-argument functor. (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 205, column 2, included from
Chain 12 '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 246, column 2, included from
Chain 12 '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 290, column 2, included from
Chain 12 '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 3, column 4) (in '/tmp/RtmptDpbv3/model-15677917d01ae0.stan', line 32, column 6 to line 36, column 8)
Chain 13 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Warning: Chain 12 finished unexpectedly!

Chain 1 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 4 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 16 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 15 Iteration:  200 / 2000 [ 10%]  (Warmup) 
Chain 7 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 5 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 6 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 8 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 9 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 10 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 11 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 14 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 1 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 4 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 13 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 16 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 7 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 15 Iteration:  300 / 2000 [ 15%]  (Warmup) 
Chain 5 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 6 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 9 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 10 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 8 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 11 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 14 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 1 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 13 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 4 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 15 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 16 Iteration:  400 / 2000 [ 20%]  (Warmup) 
Chain 5 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 7 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 6 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 8 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 9 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 10 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 11 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 1 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 13 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 14 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 4 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 15 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 16 Iteration:  500 / 2000 [ 25%]  (Warmup) 
Chain 5 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 7 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 6 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 8 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 9 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 10 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 1 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 11 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 4 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 14 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 13 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 15 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 16 Iteration:  600 / 2000 [ 30%]  (Warmup) 
Chain 5 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 7 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 9 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 1 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 6 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 8 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 10 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 4 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 11 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 14 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 13 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 16 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 5 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 7 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 15 Iteration:  700 / 2000 [ 35%]  (Warmup) 
Chain 9 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 6 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 1 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 8 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 10 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 4 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 11 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 13 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 14 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 16 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 5 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 7 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 15 Iteration:  800 / 2000 [ 40%]  (Warmup) 
Chain 9 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 6 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 8 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 11 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 1 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 1 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 10 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 16 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 13 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 14 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 4 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 4 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 15 Iteration:  900 / 2000 [ 45%]  (Warmup) 
Chain 5 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 5 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 7 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 7 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 6 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 6 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 9 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 9 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 10 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 10 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 1 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 8 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 8 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 4 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 11 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 11 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 13 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 13 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 14 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 16 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 16 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 14 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 15 Iteration: 1000 / 2000 [ 50%]  (Warmup) 
Chain 15 Iteration: 1001 / 2000 [ 50%]  (Sampling) 
Chain 5 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 7 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 6 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 9 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 10 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 1 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 8 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 11 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 13 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 14 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 15 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 16 Iteration: 1100 / 2000 [ 55%]  (Sampling) 
Chain 4 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 5 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 7 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 8 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 10 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 1 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 6 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 9 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 11 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 13 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 14 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 16 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 4 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 15 Iteration: 1200 / 2000 [ 60%]  (Sampling) 
Chain 5 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 8 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 10 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 1 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 6 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 7 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 11 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 14 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 9 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 13 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 16 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 4 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 15 Iteration: 1300 / 2000 [ 65%]  (Sampling) 
Chain 5 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 8 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 10 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 11 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 14 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 1 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 6 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 7 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 13 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 9 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 16 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 4 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 15 Iteration: 1400 / 2000 [ 70%]  (Sampling) 
Chain 5 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 8 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 10 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 11 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 14 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 1 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 6 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 13 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 7 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 4 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 9 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 10 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 15 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 16 Iteration: 1500 / 2000 [ 75%]  (Sampling) 
Chain 8 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 5 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 11 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 14 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 1 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 6 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 13 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 7 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 8 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 10 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 16 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 4 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 9 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 15 Iteration: 1600 / 2000 [ 80%]  (Sampling) 
Chain 5 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 11 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 14 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 1 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 6 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 13 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 8 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 10 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 7 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 15 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 4 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 11 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 14 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 16 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 9 Iteration: 1700 / 2000 [ 85%]  (Sampling) 
Chain 5 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 1 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 6 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 8 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 10 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 13 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 7 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 14 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 16 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 4 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 11 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 15 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 5 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 9 Iteration: 1800 / 2000 [ 90%]  (Sampling) 
Chain 1 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 8 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 13 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 1 finished in 14.6 seconds.
Chain 8 finished in 14.3 seconds.
Chain 6 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 10 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 10 finished in 14.2 seconds.
Chain 14 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 14 finished in 14.2 seconds.
Chain 11 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 16 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 4 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 7 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 15 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 4 finished in 14.9 seconds.
Chain 11 finished in 14.5 seconds.
Chain 5 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 5 finished in 15.0 seconds.
Chain 9 Iteration: 1900 / 2000 [ 95%]  (Sampling) 
Chain 13 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 13 finished in 14.7 seconds.
Chain 6 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 6 finished in 15.3 seconds.
Chain 16 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 16 finished in 14.9 seconds.
Chain 7 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 15 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 7 finished in 15.5 seconds.
Chain 15 finished in 15.1 seconds.
Chain 9 Iteration: 2000 / 2000 [100%]  (Sampling) 
Chain 9 finished in 15.8 seconds.
Warning: 3 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 16.3 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2134.45 -2134.14 1.02 0.73 -2136.42 -2133.49 1.00     4824     5636
    mu        1.53     1.53 0.05 0.05     1.46     1.61 1.00     3835     4210
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.00     3937     4425

@seabbs
Copy link
Contributor Author

seabbs commented Sep 5, 2024

Now varying up the amount of truncation (D is the obs time) with 16 chains so results have high variance. We see as expected that we have fewer issues with less truncation but when we allow for very long delays the number of failures spikes. My guess is that this is because we have lots of very low probabilities in the tail and these are also unstable (but I would imagine unstable in a different way to the truncation (need to repeat the test without truncation in the model to see).

Surprisingly to me based on investigation so far when you have very heavily truncated delays you get increasingly fewer delays with the failure hump being 8-12 days in this example. This breaks down at 2 though. This few chains means that this is all ver random

D = 2: 87.5%
D = 4: 0%
D = 6: 6.25%
D = 8: 12.5% (0%)
D = 10: 37.5% (37.5%)
D = 12: 18.5% (12.5%)
D = 15: 25%
D = 20: 12.5%
D = 25: 18.5%
D = 35: 12.5%
D = 45: 6.25%
D = 55: 6.25%
D = 100: 25%

@seabbs
Copy link
Contributor Author

seabbs commented Sep 6, 2024

I'm now experimenting with a mid point approximation when the cdf is very small or very big. This could have some weird issues with different primary event distributions. I think if it works an improved version would to choose the mid point based on the mode of the primary event distribution?

@seabbs seabbs mentioned this issue Sep 6, 2024
9 tasks
@seabbs
Copy link
Contributor Author

seabbs commented Sep 6, 2024

Code currently on main (e800dfd) with 600 chains gives.

Warning: 88 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 933.6 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2134.45 -2134.14 1.01 0.71 -2136.46 -2133.50 1.00   190824   227220
    mu        1.53     1.53 0.05 0.05     1.46     1.62 1.00   159319   169045
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.00   156998   182200

So a 15% failure rate. Failures are all post-initialisation

It looks like most of the failures we are now seeing are of the following form (this was at 250 warm up steps):

Chain 277 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
Chain 277 Exception: Exception: Exception: Exception: Exception: Exception: lognormal_lcdf: Scale parameter is inf, but must be positive finite! (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 31, column 20, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 145, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 198, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 246, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 294, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 28, column 6 to line 32, column 8)
Chain 277 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
Chain 277 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
Chain 277 
Chain 277 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
Chain 277 Exception: Exception: Exception: Exception: Exception: Exception: lognormal_lcdf: Scale parameter is inf, but must be positive finite! (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 31, column 20, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 145, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 198, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 246, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 294, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 28, column 6 to line 32, column 8)
Chain 277 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
Chain 277 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
Chain 277 
Chain 277 Exception initializing step size.
Chain 277 Exception: Exception: Exception: Exception: Error in function tanh_sinh<double>::integrate: The tanh_sinh quadrature evaluated your function at a singular point and got -1.289383087558859e-05. Integration bounds were automatically narrowed, but the integral was found to be increasing at the new endpoint.  Please check your function, and consider providing a 2-argument functor. (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 198, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 246, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/home/seabbs/Dropbox/academic/projects/censoreddiststan/inst/stan/primary_censored_dist.stan', line 297, column 2, included from
Chain 277 '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 3, column 4) (in '/tmp/RtmpZODrPn/model-19986b4543f78b.stan', line 28, column 6 to line 32, column 8)

Given I assume the lack of support for scale = Inf this is a little surprising. An investigation is a good idea.

@seabbs
Copy link
Contributor Author

seabbs commented Sep 6, 2024

Not passing the now redundant xc parameters (8fb2c03) helps with a speed up and potentially marginal stability improvements highlighting not to pass convenience values as parameters if at all possible.

Warning: 70 chain(s) finished unexpectedly!
The remaining chains had a mean execution time of 736.8 seconds.
Warning: The returned fit object will only read in results of successful chains. Please use read_cmdstan_csv() to read the results of the failed chains separately.Use the $output(chain_id) method for more output of the failed chains.
 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk
    lp__  -2134.46 -2134.15 1.02 0.73 -2136.49 -2133.50 1.00   196110
    mu        1.53     1.53 0.05 0.05     1.46     1.62 1.00   164346
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.00   162250

A 12% failure rate

@seabbs
Copy link
Contributor Author

seabbs commented Sep 11, 2024

Potentially we can use bridgestan to explore the gradient surface and see if we can identify the problem: https://roualdes.github.io/bridgestan/latest/languages/r.html

an alternative is trying to get a reject statement to work inside the integrand which so far hasn't worked out for me. If we had a try catch around the integral that also seems like it would prevent edge cases but as far as I am aware that is not something we can do in stan.

I wonder if the ODE solver does have this though and therefore is worth trying out as a drop in replacement.

@seabbs
Copy link
Contributor Author

seabbs commented Sep 12, 2024

rephrase_as_ode recasts the integral as an ODE. On first inspection, this appears to be 4 to 5 times faster and to have a 0% failure rate for 600 chains.

 variable     mean   median   sd  mad       q5      q95 rhat ess_bulk ess_tail
    lp__  -2134.46 -2134.15 1.01 0.73 -2136.47 -2133.50 1.00   223425   267773
    mu        1.53     1.53 0.05 0.05     1.46     1.62 1.00   191254   199843
    sigma     0.77     0.77 0.04 0.04     0.71     0.83 1.00   189038   221605

with no apparent impact on the estimated values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant