Learn R Programming

ngspatial (version 0.5-2)

sparse.sglmm: Fit a sparse SGLMM.

Description

Fit a sparse SGLMM.

Usage

sparse.sglmm(formula, family = gaussian, data, offset, A,
    q = 50, tol = 0.01, minit = 10000, maxit = 1e+06,
    tune = list(), hyper = list(), model = TRUE, x = FALSE,
    y = FALSE)

Arguments

formula
an object of class formula: a symbolic description of the model to be fitted.
family
a description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function, or the result of a call to a family function. (See
data
an optional data frame, list, or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are ta
offset
this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be NULL or a numeric vector of length equal to the number of cases. One or more
A
the adjacency matrix for the underlying graph, which is assumed to be undirected and free of loops and parallel edges.
q
the number of Moran eigenvectors to use. The default is 50. See `Details' for more information.
tol
a tolerance. If all Monte Carlo standard errors are smaller than tol, no more samples are drawn from the posterior. The default is 0.01.
minit
the minimum sample size. This should be large enough to permit accurate estimation of Monte Carlo standard errors. The default is 10,000.
maxit
the maximum sample size. Sampling from the posterior terminates when all Monte Carlo standard errors are smaller than tol or when maxit samples have been drawn, whichever happens first. The default is 1,000,000.
tune
(where relevant) a list containing sigma.s and sigma.h. These are the standard deviations for the $\gamma$ and $\delta$ proposals, respectively.
hyper
(where relevant) a list containing a.h and b.h, the parameters of the gamma prior for $\tau_h$.
model
a logical value indicating whether the model frame should be included as a component of the returned value.
x
a logical value indicating whether the model matrix used in the fitting process should be returned as a component of the returned value.
y
a logical value indicating whether the response vector used in the fitting process should be returned as a component of the returned value.

Value

  • sparse.sglmm returns an object of class sparse.sglmm, which is a list containing the following components.
  • coefficientsthe estimated regression coefficients.
  • fitted.valuesthe fitted mean values, obtained by transforming the linear predictors by the inverse of the link function.
  • linear.predictorsthe linear fit on link scale.
  • residualsthe response residuals.
  • iterthe size of the posterior sample.
  • beta.samplean iter by $p$ matrix containing the posterior samples for $\beta$.
  • gamma.samplean iter by $q$ matrix containing the posterior samples for $\gamma$.
  • delta.sample(where relevant) an iter by $q$ matrix containing the posterior samples for $\delta$.
  • tau.s.samplea vector containing the posterior samples for $\tau_s$.
  • tau.h.sample(where relevant) a vector containing the posterior samples for $\tau_h$.
  • gamma.estthe estimate of $\gamma$.
  • delta.est(where relevant) the estimate of $\delta$.
  • tau.s.estthe estimate of $\tau_s$.
  • tau.h.est(where relevant) the estimate of $\tau_h$.
  • beta.mcsethe Monte Carlo standard errors for $\beta$.
  • gamma.mcsethe Monte Carlo standard errors for $\gamma$.
  • delta.mcse(where relevant) the Monte Carlo standard errors for $\delta$.
  • tau.s.mcsethe Monte Carlo standard error for $\tau_s$.
  • tau.h.mcse(where relevant) the Monte Carlo standard error for $\tau_h$.
  • D.barthe goodness of fit component of the DIC.
  • pDthe penalty component of the DIC.
  • dicthe deviance information criterion$, \bar{D}+pD$.
  • beta.acceptthe acceptance rate for $\beta$.
  • gamma.acceptthe acceptance rate for $\gamma$.
  • delta.accept(where relevant) the acceptance rate for $\delta$.
  • yif requested (the default), the y vector used.
  • Xif requested, the model matrix.
  • Mif requested, the matrix of Moran eigenvectors.
  • eigen.valuesif requested, the spectrum of the Moran operator.
  • modelif requested (the default), the model frame.
  • callthe matched call.
  • formulathe formula supplied.
  • termsthe terms object used.
  • datathe data argument.
  • offsetthe offset vector used.
  • xlevels(where relevant) a record of the levels of the factors used in fitting.

Details

This function fits the sparse areal SGLMM of Hughes and Haran (2012). The first stage of the model is $$g(\mu_i)=x_i^\prime\beta+m_i^\prime\gamma\hspace{1 cm}(i=1,\dots,n)$$ or, in vectorized form, $$g(\mu)=X\beta+M\gamma,$$ where $X$ is the design matrix, $\beta$ is a $p$-vector of regression coefficients, the columns of $M$ are the first $q$ eigenvectors of the Moran operator, and $\gamma$ are spatial random effects. The second stage, i.e., the prior for $\gamma$, is $$p(\gamma\mid\tau_s)\propto\tau_s^{q/2}\exp\left(-\frac{\tau_s}{2}\gamma^\prime M^\prime QM\gamma\right),$$ where $\tau_s$ is a smoothing parameter and $Q$ is the graph Laplacian. The prior for $\beta$ is spherical $p$-variate normal with mean zero and common variance 1,000,000. The prior for $\tau_s$ is gamma with parameters 0.5 and 2,000. When the response is normally distributed, the identity link is assumed, in which case the first stage is $$\mu=X\beta+M\gamma+M\delta,$$ where $\delta$ are heterogeneity random effects. When the response is Poisson distributed, heterogeneity random effects are optional. In any case, the prior on $\delta$ is spherical $q$-variate normal with mean zero and common variance $1/\tau_h$. The prior for $\tau_h$ is gamma with parameters $a_h$ and $b_h$, the values of which are controlled by the user through argument hyper. If the response is Bernoulli or Poisson, $\beta$ and $\gamma$ are updated using Metropolis-Hastings random walks with normal proposals. The proposal covariance matrix for $\beta$ is the estimated asymptotic covariance matrix from a glm fit to the data (see vcov). The proposal for $\gamma$ is spherical normal with common standard deviation sigma.s. The updates for $\tau_s$ and $\tau_h$ are Gibbs updates irrespective of the response distribution. If the response is Poisson distributed and heterogeneity random effects are included, those random effects are updated using a Metropolis-Hastings random walk with a spherical normal proposal. The common standard deviation is sigma.h. If the response is normally distributed, all updates are Gibbs updates.

References

Hughes, J. and Haran, M. (2013) Dimension reduction and alleviation of confounding for spatial generalized linear mixed models. Journal of the Royal Statistical Society, Series B, in press.

See Also

residuals.sparse.sglmm, summary.sparse.sglmm, vcov.sparse.sglmm