Skip to contents

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

Usage

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

Arguments

beta

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

sigma

Prior for random effect SDs. Default: PC prior with P(sigma > 1) = 0.01.

phi

Prior for overdispersion parameter. Default: PC prior with P(phi > 10) = 0.01.

rho_temporal

Prior for temporal autocorrelation. Default: prior_beta(2, 2) centered at 0.5.

rho_spatial

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

Value

A tulpa_priors object

Details

PC priors (Simpson et al., 2017) provide principled regularization that:

  • Favors simpler models (smaller variance components)

  • Has interpretable parameters (tail probabilities)

  • Prevents overfitting with sparse data

For other parameters, standard distributions are available via helper functions: prior_normal(), prior_half_normal(), prior_half_cauchy(), prior_gamma(), prior_beta(), prior_exponential().

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
tulpa_priors()

# Custom fixed effect prior
tulpa_priors(beta = prior_normal(0, 1))

# Tighter random effect prior
tulpa_priors(sigma = prior_pc(U = 0.5, alpha = 0.01))

# Half-Cauchy for random effect SD
tulpa_priors(sigma = prior_half_cauchy(2.5))

# Informative prior for temporal correlation
tulpa_priors(rho_temporal = prior_beta(5, 2))  # Prior mode at ~0.8