spind (version 2.2.1)

GEE: 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 GEE plot(x, ...)

# S3 method for GEE predict(object, newdata, ...)

# S3 method for GEE summary(object, ..., printAutoCorPars = TRUE)

Arguments

formula

Model formula. Variable names must match variables in data.

family

gaussian, binomial, or poisson are supported. Called using a quoted character string (i.e. family = "gaussian").

data

A data frame with variable names that match the variables specified in formula.

coord

A matrix of two columns with corresponding cartesian coordinates. Currently only supports integer coordinates.

corstr

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

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

moran.params

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.

plot

A logical value indicating whether autocorrelation of residuals should be plotted. NOW DEPRECATED in favor of plot.GEE method.

scale.fix

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.

customize_plot

Additional plotting parameters passed to ggplot. NOW DEPRECATED in favor plot.GEE method.

x

An object of class GEE or WRM

...

Not used.

object

An object of class GEE.

newdata

A data frame containing variables to base the predictions on.

printAutoCorPars

A logical indicating whether to print the working autocorrelation parameters

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 value

p

p-values for each parameter estimate

scale

Scale parameter (dispersion parameter) of the distribution's variance

scale.fix

Logical indicating whether scale has fixed value

cluster

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 details

QLik

Quasi-likelihood. See qic.calc for further details

plot

Logical value indicating whether autocorrelation should be plotted

moran.params

Parameters for calculating Moran's I

v2

Parameter variance of the GEE model

var.naive

Parameter variance of the independence model

ac.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 fitted GEE and a GLM

Elements can be viewed using the summary.GEE methods included in the package.

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.

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

qic.calc, summary.GEE, gee

Examples

Run this code
# NOT RUN {
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'))

# }

Run the code above in your browser using DataLab