add_prior_seasonality: Add a prior on the seasonal component

View source: R/add_prior.R

add_prior_seasonalityR Documentation

Add a prior on the seasonal component

Description

The Beta distribution defined via alpha and beta is the prior on the \gamma parameter of the estimated model. For example, if we expect that the seasonal component should only update slowly over time and thus only use a small part of the error component, then a small alpha and larger beta make sense.

Usage

add_prior_seasonality(priors, prob, guess, n, verbose = FALSE, plot = FALSE)

Arguments

priors

A list containing other, already defined, priors. If NULL, a list will be started with seasonality as entry. Else, the provided list will be extended with seasonality.

prob

Probability that the time series has a seasonality, and that therefore a seasonal component should be included in the model. This parameterizes a Bernoulli distribution and should thus be a value in (0,1).

guess

Which \gamma parameter do you expect?

n

How much weight (n terms of observations) do you want to give your prior assumption? The larger this value, the more data observations it will take to wash out your prior distribution in case it is misspecified.

verbose

Should summarizing information be printed using message()?

plot

Should a simple plot of the implied Beta density be drawn?

Details

The mean of the Beta distribution is \mu = \alpha / (\alpha + \beta). If alpha is smaller or equal than 1, then the density will be highest at 0.

Value

A list that includes a list named seasonality, which is a list with prob, alpha, and beta key-value pairs.

See Also

add_prior_trend(), add_prior_level(), add_prior_error(), add_prior_anomaly()

Examples

ps <- add_prior_seasonality(
  priors = NULL, prob = 0.75, n = 6, guess = 1/6, verbose = TRUE, plot = TRUE
)

print(ps)

timradtke/heuristika documentation built on April 24, 2023, 1:55 a.m.