# Generalized linear array model

In statistics, the generalized linear array model (GLAM) is used for analyzing data sets with array structures. It based on the generalized linear model with the design matrix written as a Kronecker product.

## Overview

The generalized linear array model or GLAM was introduced in 2006. Such models provide a structure and a computational procedure for fitting generalized linear models or GLMs whose model matrix can be written as a Kronecker product and whose data can be written as an array. In a large GLM, the GLAM approach gives very substantial savings in both storage and computational time over the usual GLM algorithm.
Suppose that the data $\mathbf {Y}$ is arranged in a $d$-dimensional array with size $n_{1}\times n_{2}\times \dots \times n_{d}$; thus, the corresponding data vector $\mathbf {y} =\operatorname {vec} (\mathbf {Y} )$ has size $n_{1}n_{2}n_{3}\cdots n_{d}$. Suppose also that the design matrix is of the form
    $\mathbf {X} =\mathbf {X} _{d}\otimes \mathbf {X} _{d-1}\otimes \dots \otimes \mathbf {X} _{1}.$
The standard analysis of a GLM with data vector $\mathbf {y}$ and design matrix $\mathbf {X}$ proceeds by repeated evaluation of the scoring algorithm
    $\mathbf {X} '{\tilde {\mathbf {W} }}_{\delta }\mathbf {X} {\hat {\boldsymbol {\theta }}}=\mathbf {X} '{\tilde {\mathbf {W} }}_{\delta }{\tilde {\boldsymbol {\theta }}},$
where ${\tilde {\boldsymbol {\theta }}}$ represents the approximate solution of ${\boldsymbol {\theta }}$, and ${\hat {\boldsymbol {\theta }}}$ is the improved value of it; $\mathbf {W} _{\delta }$ is the diagonal weight matrix with elements
    $w_{ii}^{-1}=\left({\frac {\partial \eta _{i}}{\partial \mu _{i}}}\right)^{2}\mathrm {var} (y_{i}),$
and
    $\mathbf {z} ={\boldsymbol {\eta }}+\mathbf {W} _{\delta }^{-1}(\mathbf {y} -{\boldsymbol {\mu }})$
is the working variable.
Computationally, GLAM provides array algorithms to calculate the linear predictor,
    ${\boldsymbol {\eta }}=\mathbf {X} {\boldsymbol {\theta }}$
and the weighted inner product
    $\mathbf {X} '{\tilde {\mathbf {W} }}_{\delta }\mathbf {X}$
without evaluation of the model matrix $\mathbf {X} .$

### Example

In 2 dimensions, let $\mathbf {X} =\mathbf {X} _{2}\otimes \mathbf {X} _{1}$, then the linear predictor is written $\mathbf {X} _{1}{\boldsymbol {\Theta }}\mathbf {X} _{2}'$ where ${\boldsymbol {\Theta }}$ is the matrix of coefficients; the weighted inner product is obtained from $G(\mathbf {X} _{1})'\mathbf {W} G(\mathbf {X} _{2})$ and $\mathbf {W}$ is the matrix of weights; here $G(\mathbf {M} )$ is the row tensor function of the $r\times c$ matrix $\mathbf {M}$ given by
    $G(\mathbf {M} )=(\mathbf {M} \otimes \mathbf {1} ')\circ (\mathbf {1} '\otimes \mathbf {M} )$
where $\circ$ means element by element multiplication and $\mathbf {1}$ is a vector of 1's of length $c$.
On the other hand, the row tensor function $G(\mathbf {M} )$ of the $r\times c$ matrix $\mathbf {M}$ is the example of Face-splitting product of matrices, which was proposed by Vadym Slyusar in 1996:
    $\mathbf {M} \bullet \mathbf {M} =\left(\mathbf {M} \otimes \mathbf {1} ^{\textsf {T}}\right)\circ \left(\mathbf {1} ^{\textsf {T}}\otimes \mathbf {M} \right),$
where $\bullet$ means Face-splitting product.
These low storage high speed formulae extend to $d$-dimensions.

## Applications

GLAM is designed to be used in $d$-dimensional smoothing problems where the data are arranged in an array and the smoothing matrix is constructed as a Kronecker product of $d$ one-dimensional smoothing matrices.