| 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:
callCall
formulaModel formula
familyFamily
coordCoordinates used for the model
corstrUser-selected correlation structure
bEstimate of regression parameters
s.e.Standard errors of the estimates
zDepending on the
family, either a z or t valuepp-values for each parameter estimate
scaleScale parameter (dispersion parameter) of the distribution's variance
scale.fixLogical indicating whether
scalehas fixed valueclusterUser-specified cluster size for clustered models
fittedFitted values from the model
residNormalized Pearson residuals
w.acWorking autocorrelation parameters
Mat.acWorking autocorrelation matrix
QICQuasi Information Criterion. See
qic.calcfor further detailsQLikQuasi-likelihood. See
qic.calcfor further detailsplotLogical value indicating whether autocorrelation should be plotted
moran.paramsParameters for calculating Moran's I
v2Parameter variance of the
GEEmodelvar.naiveParameter variance of the
independencemodelac.glmAutocorrelation of GLM residuals
ac.geeAutocorrelation of GEE residuals
plotAn object of class
ggplotcontaining information on the autocorrelation of residuals from the fittedGEEand 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)