GEE {spind} | R Documentation |
GEE (Generalized Estimating Equations)
Description
GEE
provides GEE-based methods from the packages gee and geepack
to account for spatial autocorrelation in multiple linear regressions
Usage
GEE(
formula,
family,
data,
coord,
corstr = "fixed",
cluster = 3,
moran.params = list(),
plot = FALSE,
scale.fix = FALSE,
customize_plot = NULL
)
## S3 method for class 'GEE'
plot(x, ...)
## S3 method for class 'GEE'
predict(object, newdata, ...)
## S3 method for class 'GEE'
summary(object, ..., printAutoCorPars = TRUE)
Arguments
formula |
Model formula. Variable names must match variables in |
family |
|
data |
A data frame with variable names that match the variables
specified in |
coord |
A matrix of two columns with corresponding cartesian coordinates. Currently only supports integer coordinates. |
corstr |
Expected autocorrelation structure:
|
cluster |
Cluster size for cluster models
|
moran.params |
A list of parameters for calculating Moran's I.
|
plot |
A logical value indicating whether autocorrelation of
residuals should be plotted. NOW DEPRECATED in favor of |
scale.fix |
A logical indicating whether or not the scale parameter should
be fixed. The default is |
customize_plot |
Additional plotting parameters passed to |
x |
An object of class |
... |
Not used. |
object |
An object of class |
newdata |
A data frame containing variables to base the predictions on. |
printAutoCorPars |
A logical indicating whether to print the working autocorrelation parameters |
Details
GEE can be used to fit linear models for response variables with
different distributions: gaussian
, binomial
, or poisson
.
As a spatial model, it is a generalized linear model in which the residuals
may be autocorrelated. It accounts for spatial (2-dimensional)
autocorrelation of the residuals in cases of regular gridded datasets
and returns corrected parameter estimates. The grid cells are assumed to be square.
Furthermore, this function requires that all predictor variables
be continuous.
Value
An object of class GEE
. This consists of a list with the
following elements:
call
Call
formula
Model formula
family
Family
coord
Coordinates used for the model
corstr
User-selected correlation structure
b
Estimate of regression parameters
s.e.
Standard errors of the estimates
z
Depending on the
family
, either a z or t valuep
p-values for each parameter estimate
scale
Scale parameter (dispersion parameter) of the distribution's variance
scale.fix
Logical indicating whether
scale
has fixed valuecluster
User-specified cluster size for clustered models
fitted
Fitted values from the model
resid
Normalized Pearson residuals
w.ac
Working autocorrelation parameters
Mat.ac
Working autocorrelation matrix
QIC
Quasi Information Criterion. See
qic.calc
for further detailsQLik
Quasi-likelihood. See
qic.calc
for further detailsplot
Logical value indicating whether autocorrelation should be plotted
moran.params
Parameters for calculating Moran's I
v2
Parameter variance of the
GEE
modelvar.naive
Parameter variance of the
independence
modelac.glm
Autocorrelation of GLM residuals
ac.gee
Autocorrelation of GEE residuals
plot
An object of class
ggplot
containing information on the autocorrelation of residuals from the fittedGEE
and aGLM
Elements can be viewed using the summary.GEE
methods included in
the package.
Note
When using corstr = "fixed"
on large data sets, the function
may return an error, as the resulting variance-covariance matrix is too
large for R to handle. If this happens, one will have to use one of the
cluster models (i.e quadratic, exchangeable
).
Author(s)
Gudrun Carl, Sam Levin
References
Carl G & Kuehn I, 2007. Analyzing Spatial Autocorrelation in Species Distributions using Gaussian and Logit Models, Ecol. Model. 207, 159 - 170
Carey, V. J., 2006. Ported to R by Thomas Lumley (versions 3.13, 4.4, version 4.13)., B. R. gee: Generalized Estimation Equation solver. R package version 4.13-11.
Yan, J., 2004. geepack: Generalized Estimating Equation Package. R package version 0.2.10.
See Also
Examples
data(musdata)
coords<- musdata[,4:5]
## Not run:
mgee <- GEE(musculus ~ pollution + exposure,
family = "poisson",
data = musdata,
coord = coords,
corstr = "fixed",
scale.fix = FALSE)
summary(mgee, printAutoCorPars = TRUE)
pred <- predict(mgee, newdata = musdata)
library(ggplot2)
plot(mgee)
my_gee_plot <- mgee$plot
# move the legend to a new position
print(my_gee_plot + ggplot2::theme(legend.position = 'top'))
## End(Not run)