View source: R/gmrf-for-gamlss.R
gamlss.gmrf | R Documentation |
The function gmrf()
can be used to fit Markov Random Field additive terms within GAMLSS.
gamlss.gmrf(x, y, w, xeval = NULL, ...)
gmrf(x, precision = NULL, neighbour = NULL, polys = NULL,
area = NULL, adj.weight = 1000, df = NULL, lambda =
NULL, start = 10, method = c("Q", "A"), control =
gmrf.control(...), ...)
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 |
adj.weight |
a value to adjust the iterative weight if necessary |
df |
degrees of freedom for fitting if required, only for |
lambda |
The smoothing parameter |
start |
starting value for the smoothing parameter |
method |
"Q" for Q-function, or "A" for alternating method |
y |
working response variable |
w |
iterative weights |
xeval |
whether to predict or not |
control |
to be use for some of the argument of |
... |
for extra arguments |
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.
a fitted gamlss object
Fernanda De Bastiani, Mikis Stasinopoulos, Robert Rigby and Vlasios Voudouris.
Maintainer: Fernanda <fernandadebastiani@gmail.com>
De Bastiani, F. Rigby, R. A., Stasinopoulos, D. M., Cysneiros, A. H. M. A. and Uribe-Opazo, M. A. (2016) Gaussian Markov random spatial models in GAMLSS. Journal of Applied Statistics, pp 1-19.
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.
Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. An older version can be found in https://www.gamlss.com/.
Rue and Held (2005) Gaussian markov random fields: theory and applications, Chapman & Hall, USA.
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, https://www.jstatsoft.org/v23/i07/.
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.
(see also https://www.gamlss.com/).
MRF
, MRFA
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.