This

Scientists and investigators in such diverse fields as geological and environmental sciences, ecology, forestry, disease mapping, and economics often encounter spatially referenced data collected over a fixed set of locations with coordinates (latitude-longitude, Easting-Northing etc.) in a region of study. Such point-referenced or geostatistical data are often best analyzed with Bayesian hierarchical models. Unfortunately, fitting such models involves computationally intensive Markov chain Monte Carlo (MCMC) methods whose efficiency depends upon the specific problem at hand. This requires extensive coding on the part of the user and the situation is not helped by the lack of available software for such algorithms. Here, we introduce a statistical software package, spBayes, built upon the R statistical computing platform that implements a generalized template encompassing a wide variety of Gaussian spatial process models for univariate as well as multivariate point-referenced data. We discuss the algorithms behind our package and illustrate its use with a synthetic and real data example.


Introduction
Recent advances in Geographical Information Systems (GIS) and Global Positioning Systems (GPS) have led to increased interest in modeling and analysis of geocoded data arising in scientific research.This interest has, in turn, led to significant developments in such modeling; see, for example, the books by Cressie (1993), Chilés and Delfiner (1999), Møller (2003), Schabenberger and Gotway (2004), and Banerjee et al. (2004) for a variety of methods and applications.Two underlying configurations are encountered commonly in practice: locations that are areas or regions with well-defined neighbors (such as pixels in a lattice, counties in a map, etc.), called areally referenced data, and locations that are points with coordinates (latitude-longitude, Easting-Northing, etc.), termed point-referenced or geostatistical.Statistical modeling approaches differ depending upon the underlying configuration: for areal data, one seeks to build models using conditional independence assumptions based upon the neighborhood or adjacency structure of the regions, while for the geostatistical setting, one incorporates spatial correlations as decaying continuously with direction and distance.
It is also well recognized in the statistics literature that spatial associations are captured most effectively using hierarchical models that build dependencies in different stages.These models follow the Bayesian paradigm of statistical inference (see, e.g., Carlin and Louis, 2000;Gelman et al., 2004), where analysis is based upon sampling from the posterior distributions of the different model parameters.Hierarchical models are especially advantageous with data sets having several lurking sources of variation and dependence, where they can estimate much richer models with less stringent assumptions.
Recent computational advances with regard to Markov chain Monte Carlo (MCMC) methods have contributed enormously to the popularity of hierarchical models in a wide array of disciplines (e.g., Gilks et al., 1996), and spatial modeling is no exception (see, e.g., Banerjee et al., 2004).In the realm of spatial statistics, hierarchical models have been widely applied to analyze both areally referenced as well as point-referenced or geostatistical data.For the former, a class of models known as Conditionally Autoregressive (CAR) models have become very popular as they are easily implemented using MCMC methods such as the Gibbs sampler.In fact, these models are somewhat naturally suited for the Gibbs sampler which draws samples from conditional distributions that are fully specified by the CAR models.Their popularity has increased in no small measure also due to their automated implementation in the WinBUGS software package.This is an offshoot of the BUGS (Bayesian inference Using Gibbs Sampling) project for the Windows platform and provides a flexible and user-friendly interface to construct hierarchical models that are implemented using a Gibbs sampler.This is performed by identifying an hierarchical model with a directed acyclic graph (DAG) whose nodes form the different components of the model and allow the language identify the full conditional distributions that need to be updated.
From an automated implementation perspective, however, the state of affairs is less encouraging for point-referenced models.While BUGS can be used to build such models, its scope is somewhat limited.First, these models involve relatively expensive matrix computations that can become prohibitive with large data sets.Second, the routines fit unmarginalized models which are less suited for direct updating using a Gibbs sampler in the BUGS paradigm and results in slower convergence of the chains.Thirdly, investigators often encounter multivariate spatial data sets with several spatially dependent responses, whose analysis requires multivariate spatial models that involve matrix computations that are poorly implemented in BUGS.Several other models for point-referenced spatial data analysis (such as non-stationary models, spatially varying regression models, multi-resolution models, and spatiotemporal models) are difficult to implement in BUGS and require specialized programming.In particular, lower-level languages such as C/C++ and Fortran are needed in conjunction with efficient matrix computation libraries such as BLAS (Basic Linear Algebra Subprograms) and LAPACK (Linear Algebra Package) to implement these models.BLAS and LAPACK subroutines and documentation are available at http://www.netlib.org/blasand http://www.netlib.org/lapack,respectively.
An exciting development in bringing bring such sophisticated statistical methodology to users is the R project (http://www.r-project.org).Not only does R offer an environment with several built-in functions for mathematical computations, it also provides an edifice for developers to build packages (or libraries) offering specialized functions.These packages can be written in lower-level languages for optimizing performance, while maintaining a friendly user-interface.
Several R packages that facilitate spatial modeling exist, but most of them do not implement Bayesian hierarchical models.The most notable exception is geoR (Ribeiro and Diggle, 2001) which implements Bayesian spatial regression models for univariate geostatistical data.In addition to handling only the simplest spatial regression models with a single dependent variable, the package does not provide a full Bayesian approach, opting rather to discretize some prior distributions for computational purposes.
This manuscript discusses a generalized template that can be used to fit a wide variety of spatial process models for univariate as well as multivariate point-referenced data.We discuss the design of our R package spBayes that implements this template using efficient MCMC algorithms.For the current article, we restrict ourselves to the Gaussian response setting as our focus is on the wide variety of Gaussian process models for spatial data analysis.Section˜2 discusses spatial regression models arising in multivariate process contexts.Next, in Section˜3 we outline the generalized template we propose to implement these models and explain how we carry out inference and spatial predictions in a sampling-based framework.The R package we envision for implementing this template is described in Section˜4 along with two illustrations.Finally, Section˜5 concludes the paper and indicates upcoming work.

Spatial regression models
We consider a multivariate spatial regression model for each site s comprising an where ) and capturing spatial variation, and ǫ(s) ∼ M V N (0, Ψ) models the measurement error effect for the response with the m × m dispersion matrix Ψ.It follows that the univariate spatial regression model is the special case where m = 1.The multivariate Gaussian process is completely specified by an m × m cross-covariance matrix function whose (i, j)-th element is the covariance between W i (s) and W j (s ′ ), with θ being certain parameters that may control correlation decay and smoothness of the process.Then, for any integer n and any collection of sites S = {s 1 , . . ., s n }, the mn × 1 vector W = [W(s i )] n i=1 is distributed as a multivariate normal distribution W ∼ M V N (0, Σ W (θ)), known as a realization of the spatial process.Here Σ W (θ) = [K(s i , s j ; θ)] n i,j=1 is the mn×mn matrix with K(s i , s j ; θ) forming the (i, j)-th m×m block.The dispersion matrix of the observed response vector , where I n is the n × n identity matrix and ⊗ denotes the Kronecker product (e.g., Harville, 1997).
Care is needed in choosing K(s, s ′ ; θ) so that Σ W (θ) is symmetric and positive definite.Modeling K(s, s ′ ; θ) is indeed more demanding than choosing realvalued covariance functions in univariate spatial modeling that are characterized by Bochner's Theorem (see, e.g., Cressie, 1993, p84) .In the multivariate setting, we require that for an arbitrary number and choice of locations, the resulting Σ W (θ) be symmetric and positive definite.Note that the cross-covariance matrix function need not be symmetric or positive definite but must satisfy K(s ′ , s; θ) = K T (s, s ′ ; θ) so that Σ W (θ) is symmetric.In the limiting sense, as s ′ → s, K(s, s; θ) = [Cov(W i (s), W j (s))] m i,j=1 becomes the symmetric and positive definite variance-covariance matrix of W(s) within site s.A theorem by Cramér (see, e.g., Chilés and Delfiner, 1999) characterizes cross-covariance functions, akin to Bochner's theorem for univariate covariance functions, but using Cramér's result in practical modeling is trivial.Recent work by Majumdar and Gelfand (2006) reviews other cross-covariance modeling approaches, such as averaging and convolving correlation functions, but point out the computational and modeling difficulties involved.
Since our primary objective is to develop a computationally feasible template that accommodates sufficiently rich multivariate spatial models, we adopt a constructive approach through coregionalization models (Wackernagel, 2003).To motivate this approach, one considers simpler cross-covariance functions and builds richer models by linearly transforming them.For instance, let W(s) = [ Wi (s)] m i=1 be an m × 1 process with independent zero-centered spatial processes with unit variance; that is, each Wi (s) ∼ GP (0, ρ(•, •)) with V ar( Wk (s)) = 1 and Cov( Wi (s), Wi (s ′ )) = ρ i (s, s ′ ; θ i ) and Cov( Wi (s), Wj (s ′ )) = 0 whenever i = j (irrespective of how close s and s ′ are), where ρ i (•; θ i ) is a correlation function associated with Wi (s) and θ i are parameters therein.This yields a diagonal cross-covariance matrix function K(s, It is easy to verify that K(s, s ′ ; θ) is a valid cross-covariance matrix.
The Matérn correlation function allows control of spatial association and smoothness (see, e.g., Stein, 1999) and is given by where φ controls the decay in spatial correlation and ν is a smoothness parameter with higher values yielding smoother process realizations.Also, Γ is the usual Gamma function while K ν is a modified Bessel function of the third kind with order ν, and s−s ′ is the Euclidean distance between sites s and s ′ .Covariance functions that depend upon the distance metric only are often referred to as isotropic.Several other choices for valid correlation functions are discussed in Banerjee et al. (2004).For Wi (s) we choose isotropic Matérn functions ρ i (s, s ′ ; θ i ) with θ i = (φ i , ν i ) for i = 1, . . ., m.
For building richer covariance structures, we assume the process W(s) = A(s) W(s) to be a linear transformation of W(s), where A(s) is a space-varying matrix transform that is nonsingular for all s.Then, the cross-covariance matrix functions are related as K(s, s ′ ; θ) = A(s) K(s, s ′ )A T (s ′ ).It is worth noting that K(s, s; θ) = I m (the m × m identity matrix), so that K(s, s; θ) = A(s)A T (s).Therefore A(s) = K 1/2 (s, s; θ) is identified as a Cholesky squareroot of K(s, s; θ) and can be taken to be lower-triangular without loss of generality.Indeed, the one-one correspondence between the elements of the Cholesky square-root matrix and the original matrix is well known (see, e.g., Harville, 1997, p229).Turning to the validity of K(s, s ′ ; θ), we argue that since K(s, s ′ ; θ) is a valid cross-covariance matrix, so is K(s, s ′ ; θ).To see this, first observe that the dispersion matrix of realizations of W(s) over S , Σ W = [K(s i , s j ; θ)] n i,j=1 , can be written as: where ⊕ is the "diagonal" or direct-sum matrix operator (e.g., [?]).Thus, ⊕ m k=1 ρ k (s i , s j ; θ k ) is an m × m diagonal matrix with ρ k (s i , s j ; θ) as its diagonals while A is a block-diagonal matrix with the i-th diagonal block being A(s i ).Since K(s i , s j ; θ) is a valid cross-covariance, Σ W is positive-definite and so is Σ W (by virtue of 3).
Stationary cross-covariance functions necessarily imply the linear transformation to be independent of space.Here, since the cross-covariance is a function of the separation between sites, we have K(s, s; θ) = K(0; θ) so that A(s) = A = K 1/2 (0; θ).In such cases, A = I ⊗ A and (3) reduces to As a further simplification, suppose we choose K(s, and results in a separable or intrinsic specification (see, e.g., Wackernagel, 2003): (5) Here, the dispersion structure separates into a spatial component R(θ) and a within-site dispersion matrix K(0; θ).While such models have nicer interpretability, they are often too simplistic, resulting in poorer fits.
3 Bayesian implementation using a generalized template

Estimation of model parameters
We adopt a Bayesian approach specifying prior distributions on the parameters to build hierarchical models that are estimated using a Gibbs sampler, with Metropolis-Hastings updates when required, for fitting our models.Although such algorithms are usually problem-specific, often requiring intensive coding, casting the problem in a general template allows several models to be fit without rewriting vast amounts of code.We cast the data model into the following generic template: where Y is the mn×1 response vector, X is the mn×1 matrix of regressors, and β is the corresponding vector of regression coefficients.The specifications for the mn×mn matrices A and W give rise to different multivariate spatial regression models.MCMC model fitting proceeds via a Gibbs sampler with Metropolis steps (see, e.g., Carlin and Louis, 2000, p159) on the marginalized scale, after integrating out W, to reduce the parameter space.In the marginalized model, the response vector is distributed as, Bayesian hierarchical models are completed by assigning prior distributions on the parameters.Customarily, we let β ∼ M V N (µ β , Σ β ), a p dimensional multivariate normal distribution.The measurement error dispersion Ψ could be assigned an inverse-Wishart prior, although one usually assumes independence of measurement error for the different response measurements in each site and thus sets Ψ = Diag[τ 2 i ] m i=1 as a diagonal matrix.Also recall that A itself is unknown and needs to be stochastically specified.As mentioned in Section˜2, the specific form of A will depend upon the exact form of A. For the stationary setting, we have A = I n ⊗ A and we assign an inverse-Wishart prior to AA T .
Finally, recall that Σ W = [ K(s i − s j ; θ)] n i,j=1 and one needs to assign priors on θ = {φ k , ν k } m k=1 .This will again depend upon the specific choice of the correlation functions.In general the spatial decay parameters are weakly identifiable and prior selection becomes an even more delicate issue, with reasonably informative priors needed for satisfactory MCMC behavior.Typically we set prior distributions for the decay parameters relative to the size of their domains; for instance, by setting the prior means to values that imply spatial ranges of approximately a certain fraction of the maximum intersite distance.For the Matérn correlation function, the smoothness parameter ν is often estimated using a uniform prior distribution with support on the interval (0, 2).This choice is motivated by earlier findings (e.g., Stein, 1999) that it is almost impossible for the data to distinguish between these smoothness parameters for values greater than 2.
The set of parameters that are to be updated in the marginalized model from (6) are generically denoting by Ω = (β, A , θ, Ψ) with posterior distribution sampled from An efficient MCMC algorithm is obtained by updating β from its M V N (µ β|• , Σ β|• ) full conditional, where All the remaining parameters have to be updated using Metropolis steps.Depending upon the application, this may be implemented using block-updates (e.g., separate multivariate proposals and subsequent acceptance or rejections for parameters in Ψ, A, and θ).On convergence, the MCMC output generates L samples, say {Ω (l) } L l=1 , from the posterior distribution in (8).

Posterior predictive inference
In updating Ω using the marginal model as outlined above, we do not directly sample the spatial coefficients W and hence cannot directly obtain W = A W. This shrinks the parameter space, resulting in a more efficient MCMC algorithm.A primary advantage of the Gaussian likelihood (as in ( 6)) is that the posterior distribution of W can be recovered in a posterior predictive fashion by sampling from P ( W| Data) ∝ P ( W|Ω, Data)P (Ω| Data)dΩ. (10) Once we have the posterior samples from P (Ω| Data), {Ω (l) } L l=1 ,posterior samples from P ( W| Data) drawn by sampling W(l) for each Ω (l) from P ( W | Ω (l) , Data).
This composition sampling is routine because P ( W | Ω, Data) in ( 10) is Gaussian; in fact, from (6) we have this distribution as The posterior estimates of these realizations can subsequently be mapped with contours to produce image and contour plots of the spatial processes.
Next, let {s 0i } n * i=1 be a collection of n * locations where we seek to predict the responses.It might also be of interest to compute the posterior predictive distribution (11) This can be computed by composition sampling by first obtaining the posterior samples {Ω (l) } L l=1 ∼ P (Ω| Data), then drawing W(l) ∼ P ( W|Ω (l) , Data) for each l as described in (10) and finally drawing W * (l) ∼ P ( W * | W(l) , Ω (l) , Data).This last distribution is derived as a conditional multivariate normal distribution, namely: Therefore, the distribution where Once { W * (l) } L l=1 have been obtained, we can easily predict the responses, say i=1 at those sites as long as the mn * × p matrix of regressors for those locations, say X * , is available.This can be done by simply sampling the conditional expectations Equivalently, predictions can be executed by drawing posterior samples from the marginal distribution below, without resorting to direct updates of the W as follows: In the stationary setting with the marginalized model, observe that Therefore, the distribution Simulating from P (Y * |Ω, Data) is routine for any given Ω.Hence, the predictive distribution is again obtained using composition sampling: for each Ω (l) ∼ P (Ω | Data), we draw Y * ,(l) ∼ P (Y * |Ω (l) , Data) to obtain posterior predictive samples {Y * ,l } L l=1 .

Model selection
Since we consider several alternative models with varying degrees of spatial richness, we use the Deviance Information Criterion (DIC) (Spiegelhalter et al., 2002) as a measure of model choice.The DIC has nice properties for Gaussian likelihoods such as ours, and is particularly convenient to compute from posterior samples.This criterion is the sum of the Bayesian deviance (a measure of model fit), and the effective number of parameters (a penalty for model com- DIC and associated statistics can be calculated from either the unmarginalized (6) or marginalized (7) likelihood.In addition to lower DIC scores, shrinkage among the random spatial effects might be considered a metric for improved model fit.This shrinkage can be seen in reduced p D values calculated with the unmarginalized model.

Illustrating spBayes
4.1 spBayes spBayes is an R package that currently hosts two core functions, ggt.sp and sp.predict, which implement the methods presented in Section 3. The underlying MCMC sampling and associated matrix algebra is written in C++ and leverages BLAS, LAPACK, and LINPACK Fortran subroutines (available at http://www.netlib.org).spBayes was written specifically as an R extension; therefore, lower-level calls to C++ and Fortran functions are through R's foreign language interfaces which allow portability across operating systems.
Because spBayes relies on lower-level calls to BLAS and LAPACK routines, users can realize substantial gains in sampling efficiency by using processor optimized versions of these packages.Depending on the operating system and processor, R can interface with several efficient BLAS and LAPACK implementations; including AMD Core Math Library (ACML); Math Kernel Library (MKL); Goto BLAS; and Automatically Tuned Linear Algebra Software (AT-LAS).

Synthetic data
A synthetic data set serves to validate our proposed modeling approach and to demonstrate the use of DIC to assess model fit.The synthetic data set describes a stationary, isotropic, non-separable multivariate process.For simplicity, we consider only two response variables (i.e., m = 2).The Matérn correlation function (2) with ν = 0.5 was used to produce the data's spatial dependence structure.Fixing ν at 0.5 reduces the Matérn to the familiar exponential correlation function, ρ(s i=1 where θ = (φ 1 , φ 2 ).The multivariate process was generated with the following parameters: The above specifications describe a multivariate process with independent non-spatial variance among the response surfaces and a strong negative cross-correlation between the spatial processes (-0.707 to be precise).
The effective range of spatial dependence (i.e., the distance at which the correlation drops to 0.05) is determined by −log(0.05)/φ.The decay parameters in φ provide an effective range of ∼ 5.0 units for the first response surface and ∼ 30.0 units for the second.Given these parameters and the marginalized likelihood (7), we can draw realizations of the desired co-varying response surfaces.Given the 150 randomly selected locations (•) in Figure 1(a), Figures 1(b) and 1(c) offer one such realization of these spatial processes.Univariate empirical semivariograms for this synthetic data along with restricted maximum likelihood (REML) estimates for the exponential covariance function parameters are provided in Figure 2.

Inference and model choice using ggt.sp
The generalized template introduced in Section˜3 suggests several potential models.Here we consider seven stationary process models of increasing complexity.Our focus is on the alternative specifications of A and W within (6).For each model, we assume an isotropic spatial process that can be modeled with the exponential correlation function.
A simple linear regression model (no random effects) is This model would suffice in the presence of negligible extraneous variation beyond what is explained by the model's regressors.However, if autocorrelation is seen in each response variable's surface, as in Figure 1, and the regressors do not account for this association as a function of distance between locations, then this model violates the implicit assumption of conditionally independent observations.The next four spatial models impose separable association structures as in ( 5).For each model, Σ W = [ K(s i −s j ; φ)] n i,j=1 , φ = {φ} m k=1 implies the response variables share a common spatial decay parameter.The first, and simplest, of these models assumes common spatial variance (i.e., σ 2 ) and no non-spatial variance, Model˜2: A = σI m and Ψ = 0.
The second spatial model allows for a common pure error variance term (i.e., τ 2 ), Model˜3: A = σI m and Ψ = τ 2 I m .
The next model extends Model 3 to allow response specific spatial and pure error variance terms, Where Model 4 assumes independence among the response surfaces' spatial variance, Model 5 explicitly models the off-diagonal element in the cross-covariance matrix K, Model˜5: where, recall, A is the square root of the m × m cross-covariance matrix.The sixth model is the non-separable form of Model 5, allowing response specific spatial decay terms, The final candidate model, extends the diagonal pure error cross-covariance matrix in Model 6 to a full matrix, allowing for non-spatial variance dependence among the response surfaces, Model˜7: A, Ψ, and φ = {φ k } m k=1 .
The ggt.sp function within spBayes was used to fit each candidate model to the synthetic data.Following the methods described in Section 3.1, the ggt.sp function generates samples from each parameter's posterior distribution.The following code blocks detail the ggt.sp arguments used to fit Model 6; the other candidate models can be fit using variations on these specifications.
The arguments for the ggt.sp function follow a logical progression through a Bayesian modeling process.The initial step is to assign appropriate prior distributions to each parameter.The prior distributions used in ggt.sp are consistent with definitions found in Appendix A of Gelman et al. (2004).The variance parameters in Model 6 are a m × m spatial cross-covariance matrix K, diagonal non-spatial cross-covariance matrix Ψ, and m spatial decay parameters φ.The code block below specifies an inverse-Wishart prior for K, separate inverse-Gamma priors for the diagonal elements of Ψ, and a single uniform prior which will be used for both of the φ.The empirical semivariograms (Figure 2) were used to help define the priors' hyperparameters.For instance, the semivariograms suggest partial sills of about 3 and 6 for the two conditional response surfaces (i.e., conditional on the regressors), and therefore these values serve as the diagonal elements in the m×m shape hyperparameter of the inverse-Wishart prior used for K.The nugget estimates from the semivariograms can guide the choice of the inverse-Gamma scale hyperparameters (i.e., 7 and 5, respectively).A shape of 2 in the inverse-Gamma suggests a distribution with infinite variance centered on the scale hyperparameter.An alternative to the inverse-Gamma is the half-Cauchy also available in spBayes (see Gelman, 2006 for further discussion).The LOGUNIF prior on φ indicates a uniform distribution with support strictly greater than zero.As noted at the end of Section 4.2, ∼ 3/φ can be considered the effective spatial range.Therefore, a vague prior on φ is a uniform distribution with support on the interval (3/3, 3/0.06) or (1, 50) distance units.K.prior <-prior(dist="IWISH", df=2, S=diag(c(3, 6))) Psi.prior.1 <-prior(dist="IG", shape=2, scale=7) Psi.prior.2<-prior(dist="IG", shape=2, scale=5) phi.prior <-prior(dist="LOGUNIF", a=0.06, b=3) The next portion of code describes how each variance parameter is updated, the assigned prior, starting values, and the order in which blocks of parameters are updated.The variance parameters within the proposed model template are updated with the Metropolis-Hastings algorithm.This algorithm requires a tuning or step-size value which defines the variance term in the multivariate normal proposal density.A tuning value or matrix of the appropriate dimension must be assigned to each variance parameter.If a matrix tuning value is specified, it must be invertible.Within the R list data structure below, the element tags (e.g., K, Psi, phi, and if the Matérn correlation function is used, nu) are keywords used by ggt.sp to link the directives with the given model parameter.Below, for example, the identity matrix serves as the starting value for K.Only three elements need to be updated in the symmetric K matrix; therefore, the tuning matrix is 3 × 3 with diagonal elements assigned to K's lower-triangle column major elements (i.e., the tuning values are K 1,1 = 0.1, K 2,1 = 0.5, K 2,2 = 0.1).
Updating parameters in blocks often provides finer control on Metropolis-Hastings acceptance rate.The value assigned to the sample.orderlist tag controls the block update sequence.The code below describes a sequential Metropolis-Hastings sampling scheme that first accepts/rejects the proposed K given the currently accepted Ψ and φ samples, then accepts/rejects Ψ given the currently accepted K and φ, then accepts/rejects φ given the currently accepted K and Ψ. var.update.control<list("K"=list(sample.order=0,starting=diag(1, 2), tuning=diag(c(0.1,0.5, 0.1)), prior=K.prior), " Psi"=list(sample.order=1,starting=1,tuning=0.3,prior=list(Psi.prior.1,Psi.prior.2)), "phi"=list(sample.order=2, starting=0.5, tuning=0.5,prior=list(phi.prior,phi.prior)) ) In the var.update.controllist, the data structure assigned to the prior tags determines several model characteristics.Model 6 is non-separable; therefore, the prior list within the phi tag defines two priors, corresponding to the first and second spatial process.If, as in the phi and Psi lists above, multiple priors are defined, the starting and tuning values are recycled.Alternatively, starting value and tuning vectors can be passed in place of the scalars.
The regression parameters, β, also receive a prior and update method.Unlike the variance parameters, the β are updated using either Gibbs (9) or Metropolis-Hastings.The code below specifies a flat prior with Gibbs updating for each element in the β parameter vector.beta.control<-list(update="GIBBS", prior=prior(dist="FLAT")) The last argument that is passed to ggt.sp defines the number of posterior samples to collect and, if random spatial effects, A W, should be recovered.run.control<list("n.samples"=5000,"sp.effects"=TRUE) These arguments are then passed to ggt.sp along with additional model specifications and data as given in the code below.Finally, as described in Section 3.3, a call to sp.DIC provides both the marginalized and unmarginalized DIC for the given ggt.sp return object.The code below calculates DIC over the interval of 1,000 to 5,000 samples.The sp.DIC function also accepts thin and end to control the sample interval over which DIC is calculated.

Synthetic data analysis results
We fit the seven competing models to the synthetic data.For each of these models, three MCMC chains were run for 5,000 iterations.Chain mixing occurred within 1,000 iterations, therefore the remaining 12,000 samples (4,000×3) were retained for posterior analysis.
DIC was used to select the best candidate model to produce response specific surfaces of random spatial effects E[W| Data], and subsequent predictions Table 1 provides p D and DIC scores for the candidate models.As noted in Section 3.3, lower DIC scores suggest better model performance; therefore, Models 5, 6, and 7 are preferred.Based on the actual number of parameters, Model 5 is the most parsimonious of the three.Separability is the distinction between Model 5 and 6.Even though Model 6 gave rise to the data, it is common that the notoriously ill-defined φ does not contribute much to model distinctions in formal model fit comparisons (e.g., DIC).Rather, we might look to the interpolated residual surfaces, empirical semivariograms, and φ estimates to determine if there is an advantage to the non-separable model.In this case, there is a strong distinction in spatial dependence trends in Figure 1 surfaces and Figure 2, and between estimates of φ 1 and φ 2 in Table 2. Following these diagnostics, we select Model 6 over Model 5.
The remaining choice is between Model 6 and 7. Unlike Model 6, Model 7 explicitly models the off-diagonal element in Ψ.The unmarginalized DIC score in Table 1 suggests that Model 7 might be the best fit.However, the marginalized DIC score for Model 7 does not show an advantage over Model 6.To better understand the contribution of the off-diagonal elements in Ψ or K, it is often useful to convert these covariance matrices to the corresponding correlation matrices.For Model 7, the bounds of the 95% credible interval about Ψ's off-diagonal correlation element are -0.749 and 0.656, which suggests that the non-spatial correlation between the response surfaces is not significant.Therefore, Model 7 does not seem to add additional insight or a consistently superior model DIC score over Model 6.
Under models with Ψ = 0, for instance Models 1 and 2, the unmarginalized target likelihood reduces to the marginalized likelihood.Therefore, the unmarginalized DIC and associated statistics are omitted from Table 1.
Table 2 provides parameter estimate summaries for Model 6.Because the synthetic data is only one realization of the defined model, it would be a rare occurrence for the true parameters to fall outside of the estimated 2.5%-97.5% percentiles (i.e., only a 5% chance).Indeed, Table 2 shows that the estimated intervals cover the corresponding true parameters defined in Section 4.2.Further, converting the estimates for the cross-covariance matrix K to the 50% (2.5%, 97.5%) percentiles of the posterior cross-correlation matrix, we see that the Figure 3 provides the interpolated surfaces of recovered random spatial effects E[W| Data].Conditioning only on the models' intercept terms, that are constant across the domain, causes the mean random effect surfaces to look nearly identical to the observed surfaces Figure 1.

Prediction using sp.predict
The sp.predict function will predict W * and Y * for any set of n * new sites, given a ggt.sp return object and the coordinates and covariates of the new sites.Following the methods detailed in Section 3.2, sp.predict returns samples from the joint posterior predictive distribution of the set of new sites.This process is illustrated using the ggt.sp return object, ggt.Model.6,and the 100 prediction sites in Figure 1(a) (i.e., sites denoted by a triangle symbol).The code below calls the sp.predict function.

Forest inventory data
Maps of forest attributes are important for quantifying forest carbon dynamics, monitoring forest habitat change, forecasting wood availability, and a host of other forest management and environmental initiatives.The data used in the example below is taken from permanent georeferenced forest inventory plots on the USDA Forest Service Bartlett Experimental Forest (BEF) in Bartlett, New Hampshire.The 1,053 hectare BEF covers a large elevation gradient from the village of Bartlett in the Saco River valley at 207 meters to about 914 meters above sea level.For this illustration, the focus is on predicting the spatial distribution of basal area and total tree biomass per hectare across the BEF.
Basal area is the cross-sectional area of a tree stem 1.37 meters above the ground and is measured as square meters per hectare.Tree biomass is measured as the weight of all above ground portions of the tree, expressed here as metric tons per hectare.Within the data set, basal area (BA) and biomass (BIO) per hectare are recorded at 300 forest inventory plots.Satellite imagery and other remotely sensed variables have proved useful regressors for predicting these attributes.One spring 2002 date of 30×30 Landsat 7 ETM+ satellite imagery was acquired for the BEF.The image was transformed to tasseled cap components of brightness (1), greenness (2), and wetness (3) using data reduction techniques.The three resulting spectral variables are labeled TC1, TC2, and TC3.In addition to these spectral variables, digital elevation model data was used to produce a 30×30 elevation (ELEV) layer for the BEF.The centroids of the 300 georeferenced inventory plots were intersected with the elevation (ELEV) and spectral variables.
To demonstrate parameter estimation and prediction, we selected randomly 150 inventory plots for model construction and left the remaining 150 for subsequent predictive mapping.For reference, the 150 model points in Figure˜5(a) are used to produce an interpolated surface for each of the two response variables, Figures 5(b) and 5(c).
Previous results suggest that there is positive spatial and non-spatial association between the conditional response surfaces (i.e., conditional on the regressors).Further, the univariate empirical semivariograms for the response variables show some disparity between the spatial ranges, specifically, spatial dependence among sites is smaller for measures of basal area per hectare.Therefore, we fit a non-separable spatial regression with full spatial and non-spatial cross-covariance matrices, K and Ψ.Further, we assume that spatial dependence can be modeled with the simple exponential correlation function.This specification corresponds to Model 7 in Section 4.3.
As in the previous illustration, the univariate empirical semivariograms provide guidance for starting values and prior hyperparameters.The ggt.sp directives for one of the six chains used for model parameter estimation are detailed in the code blocks below.Again, defining priors is the first step in the modeling process.
The vague scale matrix defined for the common inverse-Wishart centers each response on the suggested values but does not impose any off-diagonal association.The noninformative prior on the spatial decay parameters corresponds to an interval of 100 to 2,000 meters.

Forest inventory data analysis results
For parameters estimation, six MCMC chains were run for 10,000 iterations.The six chains allowed for dispersed parameter starting values and because we are interested in the influence of the prior specification on parameter estimates, each chain received a different inverse-Wishart hyperparameter scale matrix.
As seen in the synthetic data set analysis, chain mixing occurred within 1,000 iterations.Therefore, 54,000 samples were retained for posterior analysis.Visual interpretation of the changes and resulting parameter estimates suggest that for this data set, the inverse-Wishart scale hyperparamter has negligible influence on chain convergence.Table 3 provides the credible intervals for each parameter in the model.These intervals show that several regressors help explain the variation in both basal area and biomass per hectare.The significance of the off-diagonal elements K 2,1 and Ψ 2,1 suggests that there is positive spatial and non-spatial association 20 between the conditional response surfaces.Additional insight is gained by converting these off-diagonal covariances to correlations, specifically 0.886 (0.241, 0.952) and 0.84 (0.111, 0.941) are the 50% (2.5%, 97.5%) percentiles of the K 2,1 and Ψ 2,1 elements, respectively.The spatial range estimates in Table 3 do not support a distinction between the responses' spatial dependence structure, therefore, the separable form of this model might be considered.Given the parameters posterior samples, we can now turn to predicting basal area and biomass for the holdout set of sites marked with triangle symbols in Figure 5(a).Alternatively, we could make predictions for each 30 × 30 meter pixel in the image stack of derived satellite spectral components and ELEV variable.Again, the predictions are made using the sp.predict function and passing in the ggt.chain.1 object returned from ggt.sp along with the new sites' coordinates and covariates.

Summary
There is a need within the scientific community for software tools capable of efficiently fitting complex co-varying point level Gaussian spatial process models.The generalized template introduced in Section˜3 allows univariate and multivariate Gaussian models to be cast in a common framework.This facilitates model parameter estimation and predictive inference implemented in the spBayes package.As detailed in the formal spBayes documentation, the ggt.sp functions accepts the set of usual covariance functions for modeling spatial dependence, and prior distributions for the variance and covariate parameters.
Although the illustrations presented here consider only bivariate processes, ggt.sp and the support functions easily accommodate any number of response variables and associated covariates.Computing time is the only restriction.The computational burden for implementing our template will explode with a large number of locations.This is known as the so-called "big-N" problem in spatial statistics and is an area of active research.Strategies for addressing this problem involve representing the spatial process W(s) over a smaller set of representative locations (called knots).
We hope future releases of spBayes will continue to help fulfill multivariate spatial process modeling needs.In the near-term, we plan to include facilities for modeling big-N problems, spatially varying regressors, multi-resolution or spatially nested models, and non-Gaussian response models.
plexity).Lower DIC values indicate the preferred models.The deviance, up to an additive quantity not depending upon Ω, is simply the negative of twice the log-likelihood, D(Ω) = −2 log L(Data| Ω), where L(Data| Ω) is the first stage Gaussian likelihood from (6) for the respective models.The Bayesian deviance is the posterior mean, D(Ω) = E Ω|Y [D(Ω)], while the effective number of parameters is given by p D = D(Ω) − D( Ω), where Ω is the posterior mean of the model parameters Ω.The DIC is then given by D(Ω) + p D .

Figure 1 :
Figure 1: (a) Random points used to generate the synthetic data set.Subsequent parameter estimation is based on 150 (•) locations, and prediction at the 100 open triangle locations (△).Plots (b) and (c) are interpolated surfaces of the first

Figure 3 :
Figure 3: Interpolated surfaces of the recovered random spatial effects for Model˜6, E[W| Data].

Figure 4 :
Figure 4: (a) Interpolated surfaces of the predicted random spatial effects for Model˜6, E[W * | Data].(b) Interpolated surfaces of the posterior predictive distributions for Model˜6, E[Y * | Data].

Figure 5 :Figure 6 :
Figure 5: (a) Forest inventory plots across the Bartlett Experimental Forest.The 300 plots were divided randomly into 150 plots used for parameter estimation denoted with solid dot symbols (•) and the remaining 150 used for

Table 1 :
Synthetic data model comparison using the DIC criterion.For each model both marginalized and unmarginalized p D and DIC were calculated from three chains of 5,000 samples.

Table 2 :
Percentiles of the posterior distributions of the parameters in Model 6. β subscripts refer to the response variable and parameter, respectively.Subscripts on K and Ψ refer to the covariance matrix element.Subscripts on the spatial decay parameters, φ, refer to the response variable.Summaries generated from three chains of 4,000 samples.

Table 3 :
Percentiles of the posterior distribution of model parameters.β subscripts refer to the response variable and parameter, respectively.Subscripts on K and Ψ refer to the covariance matrix element.Subscripts on the spatial decay parameters, φ, refer to the response variable model.Summaries generated from six chains of 9,000 samples.