# mrf: Generate design for a 2-D Gaussian Markov Random Field In spikeSlabGAM: Bayesian Variable Selection and Model Choice for Generalized Additive Mixed Models

## Description

The returned design is (a low-rank approximation to) the matrix square root of the implied covariance of the centered MRF. The function stops if 'islands', i.e. regions without any neighbors are found. Regions without observations have to be removed from the neighborhood matrix and there is currently no `predict`-functionality for regions without observations in the original data.

## Usage

 ```1 2``` ```mrf(x, N, decomposition = c("ortho", "MM"), tol = 1e-10, rankZ = 0.995) ```

## Arguments

 `x` a factor: which observation belongs to which region `N` the neighborhood (adjacency) matrix: a symmetric matrix with one column/row for every level of `x`, defining the neighborhood structure (either 0-1 or with positive weights, e.g. based on shared boundary length or centroid distances). Has to have rownames and column names that correspond to the levels of `x`, the function checks whether the rows/columns are in the same order as the levels of `x`. Entries on the diagonal are ignored. `decomposition` use a (truncated) spectral decomposition of the implied prior covariance of f(x) for a low rank representation with orthogonal basis functions and i.i.d. coefficients (`"ortho"`), or use the mixed model reparameterization for non-orthogonal basis functions and i.i.d. coefficients (`"MM"`). Defaults to `"MM"`. `tol` count singular/eigenvalues smaller than this as zero `rankZ` how many eigenvectors to retain from the eigen decomposition: either a number > 3 or the proportion of the sum of eigenvalues the retained eigenvectors must represent at least. Defaults to .999.

## Value

a transformed design matrix for the Markov Random Field

Fabian Scheipl

## References

Fahrmeir, L., Lang, S. (2001) Bayesian inference for generalized additive mixed models based on Markov random field priors. Applied Statistics, 50(2):201–220.

spikeSlabGAM documentation built on Sept. 21, 2018, 6:37 p.m.