Skip to contents

Extract specified loo estimate

Usage

summarise_loo_estimate(
  seromodel,
  par_loo_estimate = "elpd_loo",
  loo_estimate_digits = 2
)

Arguments

seromodel

stan_fit object obtained from sampling a model with fit_seromode

par_loo_estimate

Name of the loo estimate to be extracted. Available options are:

"elpd_loo"

Expected log pointwise predictive density

"p_loo"

Effective number of parameters

"looic"

Leave-one-out cross-validation information criteria

For additional information refer to loo.

loo_estimate_digits

Number of loo estimate digits

Value

Text summarising specified loo estimate

Examples

data(veev2012)
seromodel <- fit_seromodel(veev2012, iter = 100)
#> 
#> SAMPLING FOR MODEL 'constant_no_seroreversion' NOW (CHAIN 1).
#> Chain 1: Rejecting initial value:
#> Chain 1:   Log probability evaluates to log(0), i.e. negative infinity.
#> Chain 1:   Stan can't start sampling from this initial value.
#> Chain 1: 
#> Chain 1: Gradient evaluation took 2.4e-05 seconds
#> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.24 seconds.
#> Chain 1: Adjust your expectations accordingly!
#> Chain 1: 
#> Chain 1: 
#> Chain 1: WARNING: There aren't enough warmup iterations to fit the
#> Chain 1:          three stages of adaptation as currently configured.
#> Chain 1:          Reducing each adaptation stage to 15%/75%/10% of
#> Chain 1:          the given number of warmup iterations:
#> Chain 1:            init_buffer = 7
#> Chain 1:            adapt_window = 38
#> Chain 1:            term_buffer = 5
#> Chain 1: 
#> 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: 51 / 100 [ 51%]  (Sampling)
#> Chain 1: Iteration: 60 / 100 [ 60%]  (Sampling)
#> Chain 1: Iteration: 70 / 100 [ 70%]  (Sampling)
#> Chain 1: Iteration: 80 / 100 [ 80%]  (Sampling)
#> Chain 1: Iteration: 90 / 100 [ 90%]  (Sampling)
#> Chain 1: Iteration: 100 / 100 [100%]  (Sampling)
#> Chain 1: 
#> Chain 1:  Elapsed Time: 0.005 seconds (Warm-up)
#> Chain 1:                0.003 seconds (Sampling)
#> Chain 1:                0.008 seconds (Total)
#> Chain 1: 
#> 
#> SAMPLING FOR MODEL 'constant_no_seroreversion' NOW (CHAIN 2).
#> Chain 2: 
#> Chain 2: Gradient evaluation took 2e-05 seconds
#> Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds.
#> Chain 2: Adjust your expectations accordingly!
#> Chain 2: 
#> Chain 2: 
#> Chain 2: WARNING: There aren't enough warmup iterations to fit the
#> Chain 2:          three stages of adaptation as currently configured.
#> Chain 2:          Reducing each adaptation stage to 15%/75%/10% of
#> Chain 2:          the given number of warmup iterations:
#> Chain 2:            init_buffer = 7
#> Chain 2:            adapt_window = 38
#> Chain 2:            term_buffer = 5
#> Chain 2: 
#> Chain 2: Iteration:  1 / 100 [  1%]  (Warmup)
#> Chain 2: Iteration: 10 / 100 [ 10%]  (Warmup)
#> Chain 2: Iteration: 20 / 100 [ 20%]  (Warmup)
#> Chain 2: Iteration: 30 / 100 [ 30%]  (Warmup)
#> Chain 2: Iteration: 40 / 100 [ 40%]  (Warmup)
#> Chain 2: Iteration: 50 / 100 [ 50%]  (Warmup)
#> Chain 2: Iteration: 51 / 100 [ 51%]  (Sampling)
#> Chain 2: Iteration: 60 / 100 [ 60%]  (Sampling)
#> Chain 2: Iteration: 70 / 100 [ 70%]  (Sampling)
#> Chain 2: Iteration: 80 / 100 [ 80%]  (Sampling)
#> Chain 2: Iteration: 90 / 100 [ 90%]  (Sampling)
#> Chain 2: Iteration: 100 / 100 [100%]  (Sampling)
#> Chain 2: 
#> Chain 2:  Elapsed Time: 0.005 seconds (Warm-up)
#> Chain 2:                0.003 seconds (Sampling)
#> Chain 2:                0.008 seconds (Total)
#> Chain 2: 
#> 
#> SAMPLING FOR MODEL 'constant_no_seroreversion' NOW (CHAIN 3).
#> Chain 3: Rejecting initial value:
#> Chain 3:   Log probability evaluates to log(0), i.e. negative infinity.
#> Chain 3:   Stan can't start sampling from this initial value.
#> Chain 3: Rejecting initial value:
#> Chain 3:   Log probability evaluates to log(0), i.e. negative infinity.
#> Chain 3:   Stan can't start sampling from this initial value.
#> Chain 3: 
#> Chain 3: Gradient evaluation took 2e-05 seconds
#> Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds.
#> Chain 3: Adjust your expectations accordingly!
#> Chain 3: 
#> Chain 3: 
#> Chain 3: WARNING: There aren't enough warmup iterations to fit the
#> Chain 3:          three stages of adaptation as currently configured.
#> Chain 3:          Reducing each adaptation stage to 15%/75%/10% of
#> Chain 3:          the given number of warmup iterations:
#> Chain 3:            init_buffer = 7
#> Chain 3:            adapt_window = 38
#> Chain 3:            term_buffer = 5
#> Chain 3: 
#> Chain 3: Iteration:  1 / 100 [  1%]  (Warmup)
#> Chain 3: Iteration: 10 / 100 [ 10%]  (Warmup)
#> Chain 3: Iteration: 20 / 100 [ 20%]  (Warmup)
#> Chain 3: Iteration: 30 / 100 [ 30%]  (Warmup)
#> Chain 3: Iteration: 40 / 100 [ 40%]  (Warmup)
#> Chain 3: Iteration: 50 / 100 [ 50%]  (Warmup)
#> Chain 3: Iteration: 51 / 100 [ 51%]  (Sampling)
#> Chain 3: Iteration: 60 / 100 [ 60%]  (Sampling)
#> Chain 3: Iteration: 70 / 100 [ 70%]  (Sampling)
#> Chain 3: Iteration: 80 / 100 [ 80%]  (Sampling)
#> Chain 3: Iteration: 90 / 100 [ 90%]  (Sampling)
#> Chain 3: Iteration: 100 / 100 [100%]  (Sampling)
#> Chain 3: 
#> Chain 3:  Elapsed Time: 0.005 seconds (Warm-up)
#> Chain 3:                0.003 seconds (Sampling)
#> Chain 3:                0.008 seconds (Total)
#> Chain 3: 
#> 
#> SAMPLING FOR MODEL 'constant_no_seroreversion' NOW (CHAIN 4).
#> Chain 4: Rejecting initial value:
#> Chain 4:   Log probability evaluates to log(0), i.e. negative infinity.
#> Chain 4:   Stan can't start sampling from this initial value.
#> Chain 4: 
#> Chain 4: Gradient evaluation took 2e-05 seconds
#> Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds.
#> Chain 4: Adjust your expectations accordingly!
#> Chain 4: 
#> Chain 4: 
#> Chain 4: WARNING: There aren't enough warmup iterations to fit the
#> Chain 4:          three stages of adaptation as currently configured.
#> Chain 4:          Reducing each adaptation stage to 15%/75%/10% of
#> Chain 4:          the given number of warmup iterations:
#> Chain 4:            init_buffer = 7
#> Chain 4:            adapt_window = 38
#> Chain 4:            term_buffer = 5
#> Chain 4: 
#> Chain 4: Iteration:  1 / 100 [  1%]  (Warmup)
#> Chain 4: Iteration: 10 / 100 [ 10%]  (Warmup)
#> Chain 4: Iteration: 20 / 100 [ 20%]  (Warmup)
#> Chain 4: Iteration: 30 / 100 [ 30%]  (Warmup)
#> Chain 4: Iteration: 40 / 100 [ 40%]  (Warmup)
#> Chain 4: Iteration: 50 / 100 [ 50%]  (Warmup)
#> Chain 4: Iteration: 51 / 100 [ 51%]  (Sampling)
#> Chain 4: Iteration: 60 / 100 [ 60%]  (Sampling)
#> Chain 4: Iteration: 70 / 100 [ 70%]  (Sampling)
#> Chain 4: Iteration: 80 / 100 [ 80%]  (Sampling)
#> Chain 4: Iteration: 90 / 100 [ 90%]  (Sampling)
#> Chain 4: Iteration: 100 / 100 [100%]  (Sampling)
#> Chain 4: 
#> Chain 4:  Elapsed Time: 0.005 seconds (Warm-up)
#> Chain 4:                0.003 seconds (Sampling)
#> Chain 4:                0.008 seconds (Total)
#> Chain 4: 
#> Warning: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
#> Running the chains for more iterations may help. See
#> https://mc-stan.org/misc/warnings.html#bulk-ess
#> Warning: Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
#> Running the chains for more iterations may help. See
#> https://mc-stan.org/misc/warnings.html#tail-ess
summarise_loo_estimate(seromodel)
#> Warning: Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.
#> [1] "-23.33(se=11.68)"