Use a random walk to model a main effect, or use multiple random walks to model an interaction. Typically used with age or time effects or with interactions that involve age or time.
Details
If RW()
is used with an interaction,
separate random walks are constructed along
the 'along' variable, within each combination of the
'by' variables.
Argument s
controls the size of innovations.
Smaller values for s
tend to give smoother series.
Mathematical details
When RW()
is used with a main effect,
$$\beta_j = \beta_{j-1} + \epsilon_j$$ $$\epsilon_j \sim \text{N}(0, \tau^2),$$
and when it is used with an interaction,
$$\beta_{u,v} = \beta_{u,v-1} + \epsilon_{u,v}$$ $$\epsilon_{u,v} \sim \text{N}(0, \tau^2),$$
where
\(\pmb{\beta}\) is the main effect or interaction;
\(j\) denotes position within the main effect;
\(v\) denotes position within the 'along' variable of the interaction; and
\(u\) denotes position within the 'by' variable(s) of the interaction.
Parameter \(\tau\)
has a half-normal prior
$$\tau \sim \text{N}^+(0, \text{s}^2),$$
where s
is provided by the user.