add_prior_level: Add a prior on the level component

View source: R/add_prior.R

add_prior_levelR Documentation

Add a prior on the level component

Description

The Beta distribution defined via alpha and beta is the prior on the \alpha parameter of the estimated model. For example, if we expect that the level of the time series varies slowly over time, and thus only a small part of the error component is used to update the level at each time point, then a small alpha and larger beta make sense.

Usage

add_prior_level(priors = NULL, guess, n, verbose = FALSE, plot = FALSE)

Arguments

priors

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

guess

Which \alpha 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

Note: In contrast to the trend and seasonal components, we don't specify an "inclusion" probability prob on the level component. The level component is always used.

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.

Values of alpha closer to 0 imply a non-fluctating i.i.d. level component, while values of alpha closer to 1 imply a more random-walk-like behavior.

Value

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

See Also

add_prior_seasonality(), add_prior_trend(), add_prior_error(), add_prior_anomaly()

Examples

ps <- add_prior_level(
  priors = list(), guess = 1/7, n = 6, verbose = TRUE, plot = TRUE
)

print(ps)


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