gamlss.gmrf: Gaussian Markov Random Field fitting within GAMLSS

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/gmrf-for-gamlss.R

Description

The function gmrf() can be used to fit Markov Random Field additive terms within GAMLSS.

Usage

1
2
3
4
5
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(...), ...)

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 x, see example below

adj.weight

a value to adjust the iterative weight if necessary

df

degrees of freedom for fitting if required, only for method="A"

lambda

The smoothing parameter lambda if known, only for method="A"

start

starting value for the smoothing parameter lambda

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 MRF().

...

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 <[email protected]>

References

Stasinopoulos, D. M., Rigby, R. A., Heller, G. Z., Voudouris, V. and De Bastiani, F. (2017) Flexible Regression and Smoothing: Using GAMLSS in R. Chapman and Hall, Boca Raton. (see also http://www.gamlss.org/)

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.

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, 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")

Example output

Loading required package: gamlss.dist
Loading required package: MASS
Loading required package: gamlss
Loading required package: splines
Loading required package: gamlss.data
Loading required package: nlme
Loading required package: parallel
 **********   GAMLSS Version 5.0-2  ********** 
For more on GAMLSS look at http://www.gamlss.org/
Type gamlssNews() to see new features/changes/bug fixes.

Loading required package: gamlss.add
Loading required package: mgcv
This is mgcv 1.8-20. For overview type 'help("mgcv-package")'.
Loading required package: nnet

Attaching package: 'nnet'

The following object is masked from 'package:mgcv':

    multinom

Loading required package: rpart
Loading required package: spam
Loading required package: dotCall64
Loading required package: grid
Spam version 2.1-1 (2017-07-02) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction 
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package: 'spam'

The following objects are masked from 'package:base':

    backsolve, forwardsolve

GAMLSS-RS iteration 1: Global Deviance = 326.4786 
GAMLSS-RS iteration 2: Global Deviance = 326.4786 
Warning message:
In sqrt(diag(shes)) : NaNs produced
GAMLSS-RS iteration 1: Global Deviance = 326.4786 
GAMLSS-RS iteration 2: Global Deviance = 326.4786 
         df      AIC
m2 24.46858 326.4786
m1 24.46858 326.4786

gamlss.spatial documentation built on May 24, 2018, 5:04 p.m.