glsm.mcmc: Conditional Simulation for a generalised linear spatial model

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

Description

This function performs conditional simulation (by MCMC) in a generalised linear spatial model for fixed parameters.

Usage

1
2
glsm.mcmc(geodata, coords = geodata$coords, data = geodata$data, 
         units.m = "default",  model, mcmc.input, messages)

Arguments

geodata

a list containing elements coords and data as described next. Typically an object of the class "geodata" - a geoR data set. If not provided the arguments coords and data must be provided instead. The list may also contain an argument units.m as described below.

coords

an n x 2 matrix, each row containing Euclidean coordinates of the n data locations. By default it takes the element coords of the argument geodata.

data

a vector with data values. By default it takes the element data of the argument geodata.

units.m

n-dimensional vector of observation times for the data. By default (units.m = "default"), it takes geodata$units.m in case this exist and else a vector of 1's.

model

defines the model components. Either an object of class likGLSM; typically output from likfit.glsm, or a list containing the arguments :

  • trendspecifies the trend (covariate) values at the data locations. See documentation of trend.spatial for further details. Default is trend = "cte".

  • betanumerical value of the mean (vector) parameter.

  • cov.modelstring indicating the name of the model for the correlation function. Further details in the documentation for cov.spatial.

  • cov.parsa vector with the 2 covariance parameters sigma^2, and phi for the underlying Gaussian field.

  • kappaadditional smoothness parameter required by the following correlation functions: "matern", "powered.exponential", "cauchy" and "gneiting.matern".

  • nuggetthe value of the nugget parameter tau^2 for the underlying Gaussian field. Default is nugget = 0.

  • aniso.parsparameters for geometric anisotropy correction. If aniso.pars = FALSE no correction is made, otherwise a two elements vector with values for the anisotropy parameters must be provided. Anisotropy correction consists of a transformation of the data and prediction coordinates performed by the function coords.aniso.

  • familyequal to either "poisson" or "binomial"

  • linkequal to either "canonical" (default), "log", "boxcox" or "logit". For "canonical" then in general the canonical link function is used ("log" for the Poisson distribution and "logit" for the binomial distribution), but when lambda is also specified then the Box-Cox class is used (a mis-use of the terminology "canonical", really).

  • lambdanumeric value of the Box-Cox transformation parameter. The value lambda = 1 corresponds to no transformation and the default value lambda = 0 corresponds to the log-transformation. Only used when family = "poisson"

mcmc.input

input parameter for the MCMC algorithm. It can take an output from mcmc.control or a list with elements as for the arguments in mcmc.control. See documentation for mcmc.control.
ATTENTION: the argument S.scale is necessary while all the others have default values.

messages

logical. Indicates whether or not status messages are printed on the screen (or other output device) while the function is running.

Details

For simulating the conditional distribution of S given y, the Langevin-Hastings algorithm with the parametrisation in Papaspilliopoulus, Roberts and Skold (2003) is used. This algorithm is a Metropolis-Hastings algorithm, where the proposal distribution uses gradient information from the log-posterior distribution.

The proposal variance (called S.scale; see mcmc.control) for the algorithm needs to be scaled such that approximately 60 percent of the proposals are accepted. We also recommend that the user to studies plots of the autocorrelations.

Value

A list with the following components:

simulations

an n x n.sim matrix with n.sim being the number of MCMC simulations. containing S_i. Each column corresponds to a conditional simulation of the conditional distribution of S_i at the data locations.

acc.rate

matrix with acceptance rates from MCMC. Only returned when no prediction locations are given.

model

Information about the model parameters, link function and error distribution family used.

geodata

Information about the data.

call

the function call.

Author(s)

Ole F. Christensen OleF.Christensen@agrsci.dk,
Paulo J. Ribeiro Jr. Paulo.Ribeiro@est.ufpr.br.

References

O. Papaspiliopoulus and G. O. Roberts and M. Skold (2003). Non-centered parameterizations for hierarchical models and data augmentation. Bayesian statistics 7 (eds. J. M. Bernardo, S. Bayarri, J. O. Berger, A. P. Dawid, D. Heckerman, A. F. M. Smith and M. West), Oxford University Press, 307-326.

Further information about geoRglm can be found at:
http://gbi.agrsci.dk/~ofch/geoRglm.

See Also

binom.krige for prediction with fixed parameters in the Binomial-normal model, pois.krige for prediction with fixed parameters in the Poisson normal model.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
if(!exists(".Random.seed", envir=.GlobalEnv, inherits = FALSE)) set.seed(1234)
data(b50)
test <- glsm.mcmc(b50, model = list(family="binomial",
             cov.pars = c(1,1), beta = c(1,0), trend =~ rnorm(50),
             cov.model="spherical", nugget=0.3),
          mcmc.input = mcmc.control(S.scale = 0.2, thin = 1))
## visulalising the MCMC output using the coda package
test.coda <- create.mcmc.coda(test, mcmc.input = list(thin = 1))
library(coda)
## Not run: 
plot(test.coda)
autocorr.plot(test.coda) 

## End(Not run)

geoRglm documentation built on May 2, 2019, 4:03 p.m.