# Comparison of spatial approaches in ADMB

*dx*and

*dy*the correlation is on a product form:

*r(dx,dy) = r*

_{x}(dx) * r_{y}(dy),

*r _{x}(dx) = (phi_{1})^{dx} *and

*r*. You need to work through the example

_{y}(dy) = (phi_{2})^{dy}*Separable: Method explanation*to fully understand separability and its relation to Kronecker products.

The example we shall use is in an agricultural setting where the response variable "yield" is allowed to vary spatially and with "variety" as an explanatory variable. A simple Gaussian model is assumed (in R-notation for the linear predictor)

*yield = variety + u(x,y) + error*

where *u(x,y)* is the spatially varying random field. Both *u(x,y)* and *error* are taken to be Gaussian, so the full model is Gaussian. Hence it is possible to write down the full covariance matrix of the vector *yield*. This is what is done in "ar1ar1_dense.tpl" which do not require random effects at all. In "ar1ar1_prior.tpl" the same is implemented using random effects and the Gaussian prior feature (in this particular example random effects does not really make the world easier). The main part of both programs is to set up the joint correlation matrix.

The formulation "ar1ar1_sparse.tpl" exploits sparseness of the precission matrix and looks very different from the other two programs. (This harder to understand and you must read!). It gives identical results, and runs much faster in larger examples when run with the "-shess" command line option.

### Running the programs

ar1ar1_dense -ind ar1ar1.dat ar1ar1_prior -ind ar1ar1.dat ar1ar1_sparse -shess -ind ar1ar1.dat

### A note on missing values

There need not be observations at every grid point, but the latent GMRF needs nevertheless to be represented in