Skip to contents

Specify priors for model parameters. Supports both PC (penalized complexity) priors for variance components and standard distributions for other parameters.

Usage

ratiod_priors(
  beta = NULL,
  sigma = NULL,
  phi = NULL,
  rho_temporal = NULL,
  rho_spatial = NULL
)

# S3 method for class 'ratiod_priors'
print(x, ...)

# S3 method for class 'ratiod_prior'
print(x, ...)

Arguments

beta

Prior for fixed effects. Default: prior_normal(0, 10).

sigma

Prior for random effect SDs. Default: prior_half_cauchy(2.5) (the Laplace backend: prior_pc(U = 1, alpha = 0.01)).

phi

Prior for the dispersion parameter. Default: a Gamma prior set by family: prior_gamma(2, 2) for lognormal, prior_gamma(2, 0.5) for gamma_gamma and poisson_gamma, prior_gamma(2, 0.1) otherwise.

rho_temporal

Prior for a temporal autocorrelation, placed on (rho + 1) / 2 so rho lives on (-1, 1). Default: prior_beta(2, 2), symmetric about rho = 0. Applies to temporal_ar1(), a spatiotemporal() interaction's AR1 time margin, the TVC arm and the multi-scale short-term arm; each block's own rho_prior overrides it.

rho_spatial

Prior for spatial proportion (BYM2). Default: prior_beta(1, 1) (uniform).

x

A ratiod_priors object from ratiod_priors(), or a single ratiod_prior from a prior_*() constructor.

...

Ignored

Value

A ratiod_priors object. A component left NULL takes its default, the same for every sampler and for prior_predict().

Details

The MCMC samplers (mode = "hmc", "ess", "pg", "gibbs", "vi", "sghmc", "sgld") evaluate a Normal prior with mean 0 on fixed effects, a Half-Cauchy prior on random-effect SDs and a Gamma prior on the dispersion parameter; a component specified with another family is refused when the model is fitted. The Laplace backend takes prior_pc() or prior_half_normal() on sigma. The constructors prior_normal(), prior_half_normal(), prior_half_cauchy(), prior_gamma(), prior_beta(), prior_exponential() and prior_pc() build each component; prior_predict() draws from any of them.

References

Simpson, D., Rue, H., Riebler, A., Martins, T. G., & Sorbye, S. H. (2017). Penalising model component complexity: A principled, practical approach to constructing priors. Statistical Science, 32(1), 1-28.

Examples

# Default priors
ratiod_priors()
#> tulpaRatio prior specification
#> =========================
#> 
#> Fixed effects (beta):
#>   default
#> 
#> Random effect SD (sigma):
#>   default
#> 
#> Overdispersion (phi):
#>   default
#> 
#> Temporal autocorrelation (rho_temporal):
#>   default
#> 
#> Spatial proportion (rho_spatial):
#>   default
#> 
#> Components marked default take default_prior() when fitted.

# Custom fixed effect prior
ratiod_priors(beta = prior_normal(0, 1))
#> tulpaRatio prior specification
#> =========================
#> 
#> Fixed effects (beta):
#>   Normal(0.00, 1.00)
#> 
#> Random effect SD (sigma):
#>   default
#> 
#> Overdispersion (phi):
#>   default
#> 
#> Temporal autocorrelation (rho_temporal):
#>   default
#> 
#> Spatial proportion (rho_spatial):
#>   default
#> 
#> Components marked default take default_prior() when fitted.

# Tighter random effect prior
ratiod_priors(sigma = prior_half_cauchy(0.5))
#> tulpaRatio prior specification
#> =========================
#> 
#> Fixed effects (beta):
#>   default
#> 
#> Random effect SD (sigma):
#>   Half-Cauchy(0.50)
#> 
#> Overdispersion (phi):
#>   default
#> 
#> Temporal autocorrelation (rho_temporal):
#>   default
#> 
#> Spatial proportion (rho_spatial):
#>   default
#> 
#> Components marked default take default_prior() when fitted.

# PC prior on the random effect SD (Laplace backend, prior_predict())
ratiod_priors(sigma = prior_pc(U = 0.5, alpha = 0.01))
#> tulpaRatio prior specification
#> =========================
#> 
#> Fixed effects (beta):
#>   default
#> 
#> Random effect SD (sigma):
#>   PC prior: P(x > 0.50) = 0.010
#>     => Exponential(9.210)
#> 
#> Overdispersion (phi):
#>   default
#> 
#> Temporal autocorrelation (rho_temporal):
#>   default
#> 
#> Spatial proportion (rho_spatial):
#>   default
#> 
#> Components marked default take default_prior() when fitted.

# Informative prior for temporal correlation
ratiod_priors(rho_temporal = prior_beta(5, 2))  # Prior mode at ~0.8
#> tulpaRatio prior specification
#> =========================
#> 
#> Fixed effects (beta):
#>   default
#> 
#> Random effect SD (sigma):
#>   default
#> 
#> Overdispersion (phi):
#>   default
#> 
#> Temporal autocorrelation (rho_temporal):
#>   Beta(5.00, 2.00)  [mean = 0.71]
#> 
#> Spatial proportion (rho_spatial):
#>   default
#> 
#> Components marked default take default_prior() when fitted.