spgautor {spmodel} | R Documentation |
Fit spatial generalized autoregressive models
Description
Fit spatial generalized linear models for areal data (i.e., spatial generalized autoregressive models) using a variety of estimation methods, allowing for random effects, partition factors, and row standardization.
Usage
spgautor(
formula,
family,
data,
spcov_type,
spcov_initial,
dispersion_initial,
estmethod = "reml",
random,
randcov_initial,
partition_factor,
W,
row_st = TRUE,
M,
range_positive = TRUE,
...
)
Arguments
formula |
A two-sided linear formula describing the fixed effect structure
of the model, with the response to the left of the |
family |
The generalized linear model family describing the distribution
of the response variable to be used. Available options
|
data |
A data frame or |
spcov_type |
The spatial covariance type. Available options include
|
spcov_initial |
An object from |
dispersion_initial |
An object from |
estmethod |
The estimation method. Available options include
|
random |
A one-sided linear formula describing the random effect structure
of the model. Terms are specified to the right of the |
randcov_initial |
An optional object specifying initial and/or known values for the random effect variances. |
partition_factor |
A one-sided linear formula with a single term specifying the partition factor. The partition factor assumes observations from different levels of the partition factor are uncorrelated. |
W |
Weight matrix specifying the neighboring structure used.
Not required if |
row_st |
A logical indicating whether row standardization be performed on
|
M |
|
range_positive |
Whether the range should be constrained to be positive.
The default is |
... |
Other arguments to |
Details
The spatial generalized linear model for areal data
(i.e., spatial generalized autoregressive model) can be written as
, where
is the expectation
of the response (
) given the random errors,
is called
a link function which links together the
and
,
is the fixed effects design
matrix,
are the fixed effects,
is random error that is
spatially dependent, and
is random error that is spatially
independent.
There are six generalized linear model
families available: poisson
assumes is a Poisson random variable
nbinomial
assumes is a negative binomial random
variable,
binomial
assumes is a binomial random variable,
beta
assumes is a beta random variable,
Gamma
assumes is a gamma random
variable, and
inverse.gaussian
assumes is an inverse Gaussian
random variable.
The supports for for each family are given below:
family: support of
poisson:
;
an integer
nbinomial:
;
an integer
binomial:
;
an integer
beta:
Gamma:
inverse.gaussian:
The generalized linear model families and the parameterizations of their link functions are given below:
family: link function
poisson:
(log link)
nbinomial:
(log link)
binomial:
(logit link)
beta:
(logit link)
Gamma:
(log link)
inverse.gaussian:
(log link)
The variance function of an individual (given
)
for each generalized linear model family is given below:
family:
poisson:
nbinomial:
binomial:
beta:
Gamma:
inverse.gaussian:
The parameter is a dispersion parameter that influences
.
For the
poisson
and binomial
families, is always
one. Note that this inverse Gaussian parameterization is different than a
standard inverse Gaussian parameterization, which has variance
.
Setting
yields our parameterization, which is
preferred for computational stability. Also note that the dispersion parameter
is often defined in the literature as
, where
is the variance
function of the mean. We do not use this parameterization, which is important
to recognize while interpreting dispersion parameter estimates.
For more on generalized linear model constructions, see McCullagh and
Nelder (1989).
Together, and
are modeled using
a spatial covariance function, expressed as
, where
is the dependent error variance,
is a matrix that controls the spatial dependence structure among observations,
is the independent error variance, and
is
an identity matrix. Note that
and
must be non-negative while
must be between the reciprocal of the maximum
eigenvalue of
W
and the reciprocal of the minimum eigenvalue of
W
. Recall that and
are modeled on the link scale,
not the inverse link (response) scale. Random effects are also modeled on the link scale.
spcov_type
Details: Parametric forms for are given below:
car:
, weights matrix
, symmetry condition matrix
sar:
, weights matrix
,
indicates matrix transpose
If there are observations with no neighbors, they are given a unique variance
parameter called extra
, which must be non-negative.
estmethod
Details: The various estimation methods are
-
reml
: Maximize the restricted log-likelihood. -
ml
: Maximize the log-likelihood.
Note that the likelihood being optimized is obtained using the Laplace approximation.
By default, all spatial covariance parameters except ie
as well as all random effect variance parameters
are assumed unknown, requiring estimation. ie
is assumed zero and known by default
(in contrast to models fit using spglm()
, where ie
is assumed
unknown by default). To change this default behavior, specify spcov_initial
(an NA
value for ie
in spcov_initial
to assume
ie
is unknown, requiring estimation).
random
Details: If random effects are used, the model
can be written as ,
where each Z is a random effects design matrix and each u is a random effect.
partition_factor
Details: The partition factor can be represented in matrix form as , where
elements of
equal one for observations in the same level of the partition
factor and zero otherwise. The covariance matrix involving only the
spatial and random effects components is then multiplied element-wise
(Hadmard product) by
, yielding the final covariance matrix.
Observations with NA
response values are removed for model
fitting, but their values can be predicted afterwards by running
predict(object)
. This is the only way to perform prediction for
spgautor()
models (i.e., the prediction locations must be known prior
to estimation).
Value
A list with many elements that store information about
the fitted model object. If spcov_type
or spcov_initial
are
length one, the list has class spgautor
. Many generic functions that
summarize model fit are available for spgautor
objects, including
AIC
, AICc
, anova
, augment
, AUROC
, BIC
, coef
,
cooks.distance
, covmatrix
, deviance
, fitted
, formula
,
glance
, glances
, hatvalues
, influence
,
labels
, logLik
, loocv
, model.frame
, model.matrix
,
plot
, predict
, print
, pseudoR2
, summary
,
terms
, tidy
, update
, varcomp
, and vcov
. If
spcov_type
or spcov_initial
are length greater than one, the
list has class spgautor_list
and each element in the list has class
spgautor
. glances
can be used to summarize spgautor_list
objects, and the aforementioned spgautor
generics can be used on each
individual list element (model fit).
Note
This function does not perform any internal scaling. If optimization is not stable due to large extremely large variances, scale relevant variables so they have variance 1 before optimization.
References
McCullagh P. and Nelder, J. A. (1989) Generalized Linear Models. London: Chapman and Hall.
Examples
spgmod <- spgautor(I(log_trend^2) ~ 1, family = "Gamma", data = seal, spcov_type = "car")
summary(spgmod)