Use a line or lines with AR1 errors to model a main effect or interaction. Typically used with time.
Arguments
- min, max
Minimum and maximum values for autocorrelation coefficient. Defaults are
0.8
and0.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.
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).$$
See also
Lin_AR()
Generalization ofLin_AR1()
Lin()
Line with independent normal errorsAR1()
AR1 process with no linepriors Overview of priors implemented in bage
set_prior()
Specify prior for intercept, main effect, or interaction