Skip to contents

Use a line or lines with AR1 errors to model a main effect or interaction. Typically used with time.

Usage

Lin_AR1(min = 0.8, max = 0.98, s = 1, sd = 1, along = NULL)

Arguments

min, max

Minimum and maximum values for autocorrelation coefficient. Defaults are 0.8 and 0.98.

s

Scale for the innovations in the AR process. Default is 1.

sd

Standard deviation in the prior for the slope of the line. Larger values imply steeper slopes. Default is 1.

along

Name of the variable to be used as the "along" variable. Only used with interactions.

Value

An object of class "bage_prior_linar".

Details

If Lin_AR() is used with an interaction, separate lines are constructed along the "along" variable, within each combination of the "by" variables.

Arguments min and max can be used to specify the permissible range for autocorrelation.

Argument s controls the size of the innovations. Smaller values tend to give smoother estimates.

Argument sd controls the size of the slopes of the lines. Larger values can give more steeply sloped lines.

Mathematical details

When Lin_AR1() is being used with a main effect,

$$\beta_j = \eta q_j + \epsilon_j$$ $$\epsilon_j = \phi \epsilon_{j-1} + \varepsilon_j,$$ $$\varepsilon_j \sim \text{N}(0, \omega^2).$$

and when it is being used with an interaction,

$$\beta_{u,v} = \eta_j q_{u,v} + \epsilon_{u,v}$$ $$\epsilon_{u,v} = \phi + \varepsilon_{u,v},$$ $$\varepsilon_{u,v} \sim \text{N}(0, \omega^2).$$

where

  • \(\pmb{\beta}\) is the main effect or interaction;

  • \(j\) denotes position within the main effect;

  • \(u\) denotes position within the "along" variable of the interaction;

  • \(u\) denotes position within the "by" variable(s) of the interaction;

  • \(q = - (J+1)/(J-1) + 2j/(J-1);\) and

  • \(q_v = - (V+1)/(V-1) + 2v/(V-1)\).

The slopes have priors $$\eta \sim \text{N}(0, \text{sd}^2)$$ and $$\eta_u \sim \text{N}(0, \text{sd}^2).$$ Larger values for sd permit steeper slopes.

Internally, Lin_AR1() derives a value for \(\omega\) that gives \(\epsilon_j\) or \(\epsilon_{u,v}\) a marginal variance of \(\tau^2\). Parameter \(\tau\) has a half-normal prior $$\tau \sim \text{N}^+(0, \text{s}^2),$$ where a value for s is provided by the user.

Coefficient \(\phi\) is constrained to lie between min and max. Its prior distribution is $$\phi = (\text{max} - \text{min}) \phi' - \text{min}$$ where $$\phi' \sim \text{Beta}(2, 2).$$

References

  • The defaults for min and max are based on the defaults for forecast::ets().

See also

  • Lin_AR() Generalization of Lin_AR1()

  • Lin() Line with independent normal errors

  • AR1() AR1 process with no line

  • priors Overview of priors implemented in bage

  • set_prior() Specify prior for intercept, main effect, or interaction

Examples

Lin_AR1()
#>   Lin_AR1() 
#>        s: 1
#>       sd: 1
#>      min: 0.8
#>      max: 0.98
#>    along: NULL
Lin_AR1(min = 0, s = 0.5, sd = 2)
#>   Lin_AR1(min=0,s=0.5,sd=2) 
#>        s: 0.5
#>       sd: 2
#>      min: 0
#>      max: 0.98
#>    along: NULL