GEE provides GEE-based methods from the packages gee and geepack
to account for spatial autocorrelation in multiple linear regressions
GEE(formula, family, data, coord, corstr = "fixed", cluster = 3,
moran.params = list(), plot = FALSE, scale.fix = FALSE,
customize_plot = NULL)Model formula. Variable names must match variables in data.
gaussian, binomial, or poisson are supported.
Called using a quoted character string (i.e. family = "gaussian").
A data frame with variable names that match the variables
specified in formula.
A matrix of two columns with corresponding cartesian coordinates. Currently only supports integer coordinates.
Expected autocorrelation structure: independence, fixed,
exchangeable, and quadratic are possible.
independence - This is the same as a GLM, i.e. correlation matrix = identity matrix.
fixed - Uses an adapted isotropic power function specifying all correlation
coefficients.
exchangeable and quadratic for clustering, i.e.
the correlation matrix has a block diagonal form:
exchangeable - All intra-block correlation coefficients are equal.
quadratic - Intra-block correlation coefficients for different
distances can be different.
Cluster size for cluster models exchangeable
and quadratic. Values of 2, 3, and 4 are allowed.
2 - a 2*2 cluster
3 - a 3*3 cluster
4 - a 4*4 cluster
A list of parameters for calculating Moran's I.
lim1 Lower limit for first bin. Default is 0.
increment Step size for calculating I. Default is 1.
A logical value indicating whether autocorrelation of residuals should be plotted.
A logical indicating whether or not the scale parameter should
be fixed. The default is FALSE. Use TRUE when planning to use
stepwise model selection procedures in step.spind.
Additional plotting parameters passed to ggplot
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 value
pp-values for each parameter estimate
scaleScale parameter (dispersion parameter) of the distribution's variance
scale.fixLogical indicating whether scale has fixed value
clusterUser-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.calc
for further details
QLikQuasi-likelihood. See qic.calc
for further details
plotLogical value indicating whether autocorrelation should be plotted
moran.paramsParameters for calculating Moran's I
v2Parameter variance of the GEE model
var.naiveParamter variance of the independence model
ac.glmAutocorrelation of GLM residuals
ac.geeAutocorrelation of GEE residuals
Elements can be viewed using the summary.GEE methods included in
the package.
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.
Futhermore, this function requires that all predictor variables
be continuous.
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.
# NOT RUN {
data(musdata)
coords<- musdata[,4:5]
# }
# NOT RUN {
mgee<-GEE(musculus ~ pollution + exposure, "poisson", musdata,
coord=coords, corstr="fixed", plot=TRUE,scale.fix=FALSE,
customize_plot = scale_color_manual("Custom legend", values = c('blue','red')))
summary(mgee,printAutoCorPars=TRUE)
# }
Run the code above in your browser using DataLab