tinyVAST is a bivariate extension of a generalized linear mixed model (see Tables 1 and 2 for notation), which includes two linear predictors that each include four additive components:
Spatial interactions among variables: The user can specify interactions among variables at a given site (or for spatially correlated latent variables) using arrow notation derived from path analysis, based on the interface from R package sem;
Temporal interaction among variables: The user can specify simultaneous and lagged interactions among variables over time using an expanded arrow-and-lag notation that is derived from R package dsem, where these interactions the annual intercept for a given variable therefore apply uniformly for all locations.
Spatio-temporal interactions among variables: The user can specify simultaneous and lagged interactions among variables over time, where these interactions occur on a site-by-site basis.
Generalized additive model: The user specifies a formula for a generalized additive model (GAM) that is interpreted by R package mgcv. If other model components are missing, tinyVAST estimates parameters that are similar to mgcv, with small differences resulting from different methods for parameter estimation;
These four components are assembled into two linear predictors:
$$ \begin{aligned} p_{\mathrm 1,i} &= \underbrace{\mathbf X_{\mathrm 1,i} \mathbf\alpha_{\mathrm 1} + \mathbf Z_{\mathrm 1,i} \mathbf\gamma_{\mathrm 1}}_\text{GAM} + \underbrace{\mathbf A_{i} \mathbf\Omega_{\mathrm 1,c[i]}}_\text{space_term} + \underbrace{\mathbf D_{\mathrm 1,c[i],t[i]}}_\text{time_term} + \underbrace{\mathbf A_i \mathbf E_{\mathrm 1,c[i],t[i]}}_\text{spacetime_term} \\ p_{\mathrm 2,i} &= \underbrace{\mathbf X_{\mathrm 2,i} \mathbf\alpha_{\mathrm 2} + \mathbf Z_{\mathrm 2,i} \mathbf\gamma_{\mathrm 2}}_\text{GAM} + \underbrace{\mathbf A_{i} \mathbf\Omega_{\mathrm 2,c[i]}}_\text{space_term} + \underbrace{\mathbf D_{\mathrm 2,c[i],t[i]}}_\text{time_term} + \underbrace{\mathbf A_i \mathbf E_{\mathrm 2,c[i],t[i]}}_\text{spacetime_term} \end{aligned} $$
where
and terms are defined similarly for the second linear predictor p2, i except using subscript-2. The linear predictors are then passed through a bivariate inverse-link function to specify the distribution for errors:
yi ∼ fe[i](ge[i]−1(p1, i, p2, i), θe[i])
where
In the simple case, the distribution only requires a single linear predictor such that p2 = 0 by construction and drops out of the model. In this case, the model collapses to a generalized linear mixed model. For example we might have a log-link and Poisson distribution, such that it collapses to a log-linked Poisson GLMM, yi ∼ Poisson(ep1, i).
However, tinyVAST can also handle a delta-model using either logit-log or Poisson-linked link functions:
ge[i]−1(p1, i, p2, i) = (μ1, i, μ2, i)
where μ1, i and μ2, i are the two linear predictors, such that 𝔼[yi] = μ1, iμ2, i;
For the conventional logit-log bivariate link function we use a logit-link for encounter probabilities and a log-link for positive catch rates:
$$ \begin{aligned} \mu_{\mathrm 1,i} &= \frac{e^{p_{\mathrm 1,i}}}{1+e^{p_{\mathrm 1,i}}} \\ \mu_{\mathrm 2,i} &= e^{p_{\mathrm 2,i}} \end{aligned} $$
while for the Poisson-linked link function we specify a complemetary log-log link for encounter probabilities and define the second link function such that μ1, iμ2, i = ep1, iep2, i:
$$ \begin{aligned} \mu_{\mathrm 1,i} &= 1 - e^{-e^{p_{\mathrm 1,i}}} \\ \mu_{\mathrm 2,i} &= \frac{e^{p_{\mathrm 1,i}}}{\mu_{\mathrm 1,i}} e^{p_{\mathrm 2,i}} \end{aligned} $$ where ep1, i is the density for an underlying point process, and ep2, i is biomass per point (i.e., animal or group).
In either the conventional or Poisson-linked delta model, μ1, i = Pr(Y > 0) is the encounter probability (and is fitted with a Bernoulli distribution), while μ2, i is the central tendancy for positive values, i.e., μ2, i = 𝔼(Y|Y > 0).
Linear predictors include spatially autocorrelated latent variables. These variables are treated as Gaussian Markov random fields (GMRFs), and evaluating the probability density of GMRFs involves calculating the precision matrix Qdomain = Σ−1 as the inverse of the spatial covariance matrix. tinyVAST involves three options for specifying this spatial precision:
Qdomain = τ2(κ4M0 + 2κ2M1 + M2) where every row Ai of the interpolation matrix A is nonzero for only the three vertices of the triangle that contains sample i
Qdomain = τ2(I − κA*)2 where A* is the adjacency matrix of the graph specified by the analyst, and each row Ai of interpolation matrix A is nonzero only for the single spatial stratum containing sample i (and noting that adjacency matrix A* is different from interpolation matrix A, but we use the same notation for both due to a collision in notational standards).
For each spatial domain, the term τ is defined such that precision Qdomain has unit variance. This is done because the spatial domain always arises in combination with other parameters, which are used to define the variance of the associated spatial variable.
tinyVAST also involves specifying a structural equation model (SEM). This SEM be viewed either:
To specify a SEM, the user uses arrow notation derived from
package sem
. For example, to specify a linear model this
involves:
This then estimates a single slope parameter (represented with a one-headed arrow), as well as the variance of W1 and W2 (specified with two-headed arrows). In a more complicated case, W1 might cause W2, which in turn causes W3. This is then represented as:
# Path, parameter_name, start value
w1 -> w2, b_12, 0
w2 -> w3, b_23, 0
w1 <-> w1, s_1, 1
w2 <-> w2, s_2, 1
w3 <-> w3, s_3, 1
SEM interactions can be as complicated or simple as desired, and can include:
parameter_name
is provided as NA
and the
starting value that follows is the fixed value;parameter_name
is provided for multiple rows of the text
file.In this preceding example, path coefficients for one-headed arrows then define path matrix P:
$$ \mathbf P = \begin{pmatrix} 0 & 0 & 0 \\ b_{12} & 0 & 0 \\ 0 & b_{23} & 0 \end{pmatrix} $$
and coefficents for two-headed arrows define the Cholesky G of the exnogenous covariance matrix GTG:
$$ \mathbf G = \begin{pmatrix} s_{1} & 0 & 0 \\ 0 & s_{2} & 0 \\ 0 & 0 & s_{3} \end{pmatrix} $$
These matrices are define a simultaneous equation model:
$$ \mathbf{ w = P w + \epsilon} \\ \mathbf\epsilon \sim \mathrm{MVN}( \mathbf 0, \mathbf G^T \mathbf G ) $$ where the variance Var(w) = (I − P)−1G2(I − PT)−1. This then results in a sparse precision matrix:
Q = (I − PT)G−1G−T(I − P)
where this precision matrix Q is then used as a modular component in the larger tinyVAST model.
Similarly, tinyVAST involves specifying dynamic structural equation models (DSEM). To specify a DSEM, the user uses arrow-and-lag notation. For example, to specify a univariate first-order autoregressive process:
If there were four time-intervals (T = 4) this would then result in the path matrix:
$$ \mathbf P = \begin{pmatrix} 0 & 0 & 0 & 0 \\ \rho & 0 & 0 & 0 \\ 0 & \rho & 0 & 0 \\ 0 & 0 & \rho & 0 \end{pmatrix} $$
and when the DSEM involves multiple times and variables, the sparse precision is formed by summing across the Kronecker product of time-lag and interaction matrices. This DSEM defines a GMRF over a nonseparable interaction of time and variables, represented by a matrix Qtime_term with dimension CT × CT. The user can specify a separate arrow-and-lag notation to define the precision matrix for the time-variable interaction Qtime_term and for the space-time-variable interaction Qspacetime_term.
The precision matrix Qtime_term for the time term D is used to define the time-varying intercept for each variable:
vec(D) ∼ MVN(0, Qtime_term) Meanwhile, the space-time term Qspacetime_term is combined with the spatial precision Qspace_term as we explain next.
tinyVAST uses the SEM and DSEM notation to construct the joint precision for the space-variable interaction Ω with dimension S × C, and the space-time-variable interaction E with dimension S × C × T. To do so, it constructs the separable precision for each process:
vec(E) ∼ MVN(0, Qspacetime_term ⊗ Qdomain)
where the precision matrix Qspacetime_term ⊗ Qdomain has dimension STC × STC to match the length of vec(E), and vec(Ω) ∼ MVN(0, Qspace_term ⊗ Qdomain)
where the precision matrix Qspace_term ⊗ Qdomain has dimension SC × SC, to match the length of vec(Ω).
Finally, the analyst can specify a generalized additive model using syntax from package mgcv. For example this might involve:
If year
and species
are factors and
depth
and log_area
are continuous, then this
would specify a fixed effect for each level year
, a spline
smoother for depth
, using log_area
as an
offset, and estimating a random intercept for each level of
species
. This formula is parsed internally to assemble
fixed effects in design matrix X and the basis functions
for spline smoothers and random effects in design matrix Z. The coefficients γ associated with smoothers
and random effects are then specified to follow a GMRF:
γ ∼ GMRF(0, Qgam) where Qgam is a blockwise diagonal matrix, assembled from estimated variance parameters and matrices constructed by mgcv.
Symbol | Description |
---|---|
i | Index for each sample, i in (1, 2, ..., I) |
s[i] | spatial coordinate for sample i, s in (1, 2, ..., S) |
t[i] | time-interval for sample i, t in (1, 2, ..., T) |
c[i] | category for sample i, c in (1, 2, ..., C) |
e[i] | error distribution and link function for sample i |
Symbol | Code | Description |
---|---|---|
y | y_i |
Observed response data |
p1 | p_i |
first linear predictor |
p2 | p2_i |
second linear predictor |