The functions MRF() and MRFA() are used to fit a Gaussian Markov Random Fields (MRF) model. They are used by the functions mrf() and mrfa() respectively to fit a MRF additive term within GAMLSS
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 x, see example below.
weights
prior weights
sig2e
starting values for the error variance
sig2b
starting values for the random field variance
sig2e.fix
whether sig2e is fixed in the fitting, default equals FALSE
sig2b.fix
whether sig2B is fixed in the fitting, default equals FALSE
penalty
whether quadratic penalty is required to help convergence in for flat likelihoods, this is equivalent of putting a normal prior distribution for the log-sigmas e.g. logsig2e-N(shift, 1/delta)
delta
the precision of the prior
shift
the mean of the prior
lambda
smoothing parameter for MRFA function
start
starting value for the smoothing parameter lambda for MRFA function
df
for fixing the degrees of freedom (only in MRFA())
Details
There are two functions for fitting Markov random fields: i) MRF()) which uses the Q-function (marginal likelihood) for estimating the sig2e and sig2b parameters and ii) MRFA() which estimates the smoothing parameter lambda=sig2e/sig2b using the "alternating" method.
Value
a fitted MRF object
Author(s)
Fernanda De Bastiani, Mikis Stasinopoulos, Robert Rigby and Vlasios Voudouris.
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
Examples
library(mgcv)
data(columb)
data(columb.polys)
vizinhos=polys2nb(columb.polys)
precisionC <- nb2prec(vizinhos,x=columb$district)
# MRFA
m1<-MRFA(columb$crime, columb$district, polys=columb.polys)
m11<-MRFA(columb$crime, columb$district, precision=precisionC)
m12<-MRFA(columb$crime, columb$district, neighbour=vizinhos)
draw.polys(columb.polys, m12, scheme="heat",swapcolors=TRUE)
## Not run:
# MRF
m2<-MRF(columb$crime, columb$district, polys=columb.polys)
m21<-MRF(columb$crime, columb$district, precision=precisionC)
m22<-MRF(columb$crime, columb$district, neighbour=vizinhos)
AIC(m1, m11,m12,m2, m21, m22, k=0)
draw.polys(columb.polys, m12, scheme="heat",swapcolors=TRUE)
# removing one area
columb2 <- columb[-5,]
# creating new precision matrix
precisionC2 <- nb2prec(vizinhos,x=columb$district,area=columb$district)
# MRFA
# new data but declaring area
m11<-MRFA(columb2$crime, columb2$district, polys=columb.polys, area=columb$district)
# new data old polys
m112<-MRFA(columb2$crime, columb2$district, polys=columb.polys)
# new data old precision old area
m111<-MRFA(columb2$crime, columb2$district, precision=precisionC,area=columb$district)
# new data old neighbour old area
m121<-MRFA(columb2$crime, columb2$district, neighbour=vizinhos,area=columb$district)
# new data new precision old area
m113<-MRFA(columb2$crime, columb2$district, precision=precisionC2,area=columb$district)
AIC(m11,m112,m111,m121,m113, k=0)
m11<-MRFA(columb2$crime, columb2$district, polys=columb.polys, area=columb$district)
# new data old polys
m112<-MRFA(columb2$crime, columb2$district, polys=columb.polys)
# new data old precision old area
m111<-MRFA(columb2$crime, columb2$district, precision=precisionC,area=columb$district)
# new data old neighbour old area
m121<-MRFA(columb2$crime, columb2$district, neighbour=vizinhos,area=columb$district)
# new data new precision old area
m113<-MRFA(columb2$crime, columb2$district, precision=precisionC2,area=columb$district)
AIC(m11,m112,m111,m121,m113, k=0)
draw.polys(columb.polys, fitted(m11))
## End(Not run)