# Gaussian Markov Random Field fitting within GAMLSS

### Description

The function `gmrf()`

can be used to fit Markov Random Field additive terms within GAMLSS.

### Usage

1 2 3 |

### Arguments

`x` |
a factor containing the areas |

`precision` |
the precision matrix if set |

`neighbour` |
an object containing the neighbour information for the area if set |

`polys` |
the polygon information if set |

`area` |
this argument is here to allow more areas than the levels of the factor |

`start` |
starting value for the smoothing parameter |

`df` |
degrees of freedom for fitting if required, only for |

`method` |
"Q" for Q-function, or "A" for alternating mehtod |

`adj.weight` |
a value to adjust the iterative weight if necessary |

`y` |
working response variable |

`w` |
iterative weights |

`xeval` |
whether to predict or not |

`control` |
to be use for some of the srgument of |

`...` |
for extra arguments |

### Details

The function `gmrf()`

is to support the function `MRF()`

and `MRFA()`

within GAMLSS.
It is intended to be called within a GAMLSS formula. The function `gmrf()`

is not intended to be used directly. It is calling the function `MRFA()`

and `MRF()`

within the GAMLSS fitting algorithm.
The results using the option `method="Q"`

or `method="A"`

should produce identical results.

### Value

a fitted gamlss object

### Author(s)

Fernanda De Bastiani, Mikis Stasinopoulos, Robert Rigby and Vlasios Voudouris.

Maintainer: Fernanda <fernandadebastiani@gmail.com>

### References

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion),
*Appl. Statist.*, **54**, part 3, pp 507-554.

Rue and Held (2005) *Gaussian markov random fields: theory and applications*, Chapman & Hall, USA.

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R.
*Journal of Statistical Software*, Vol. **23**, Issue 7, Dec 2007, http://www.jstatsoft.org/v23/i07.

### See Also

`MRF`

, `MRFA`

### Examples

1 2 3 4 5 6 7 8 9 10 11 | ```
library(gamlss)
library(mgcv)
data(columb)
data(columb.polys)
vizinhos=polys2nb(columb.polys)
precisionC <- nb2prec(vizinhos,x=columb$district)
# MRFA
m1<- gamlss(crime~ gmrf(district, polys=columb.polys, method="Q"), data=columb)
m2<- gamlss(crime~ gmrf(district, polys=columb.polys, method="A"), data=columb)
AIC(m1,m2, k=0)
draw.polys(columb.polys, getSmo(m2), scheme="topo")
``` |