add_prior_trend: Add a prior on the local-linear trend component

View source: R/add_prior.R

add_prior_trendR Documentation

Add a prior on the local-linear trend component

Description

The Beta distribution defined via alpha and beta is the prior on the product \alpha \cdot \beta, where \alpha and \beta are the smoothing parameters for the level and trend components of the model.

Usage

add_prior_trend(priors = NULL, prob, guess, n, verbose = FALSE, plot = FALSE)

Arguments

priors

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

prob

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

guess

Which \alpha \cdot \beta 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 trend component is updated via \alpha \cdot \beta \cdot \epsilon_t. When \alpha=0, then the trend component will not change over time because the level component does not adjust to recent observations of the time series. Every value of \beta then has the same effect.

Specifying the prior directly on the interaction makes it easier to enforce an expected effective behavior of the trend. Independent of the value of \alpha (except for \alpha = 0), a small value for \alpha \cdot \beta implies that the trend will adjust slowly to more recent observations.

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 trend, which is a list with prob, alpha, and beta key-value pairs.

See Also

add_prior_seasonality(), add_prior_level(), add_prior_error(), add_prior_anomaly()

Examples

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

print(ps)

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