WRM {spind}R Documentation

Wavelet-revised models (WRMs)

Description

A wavelet-based method to remove spatial autocorrelation in multiple linear regressions. Wavelet transforms are implemented using waveslim (Whitcher, 2005).

Usage

WRM(
  formula,
  family,
  data,
  coord,
  level = 1,
  wavelet = "haar",
  wtrafo = "dwt",
  b.ini = NULL,
  pad = list(),
  control = list(),
  moran.params = list(),
  plot = FALSE,
  customize_plot = NULL
)

## S3 method for class 'WRM'
plot(x, ...)

## S3 method for class 'WRM'
summary(object, ...)

## S3 method for class 'WRM'
predict(object, newdata, sm = FALSE, newcoord = NA, ...)

Arguments

formula

Model formula. Variable names must match variables in data.

family

gaussian, binomial, or poisson are supported.

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.

level

An integer specifying the degree of wavelet decomposition

  • 0 - Without autocorrelation removal (equivalent to a GLM)

  • 1 - For best autocorrelation removal

  • ... - Higher integers possible. The limit depends on sample size

wavelet

Name of wavelet family. haar, d4, and la8. are possible. haar is the default.

wtrafo

Type of wavelet transform. Either dwt or modwt. dwt is the default.

b.ini

Initial parameter values. Default is NULL.

pad

A list of parameters for padding wavelet coefficients.

  • padform - 0, 1, and 2 are possible. padform is automatically set to 0 when either level=0 or a formula including an intercept and a non-gaussian family

    • 0 - Padding with 0s.

    • 1 - Padding with mean values.

    • 2 - Padding with mirror values.

  • padzone - Factor for expanding the padding zone

control

a list of parameters for controlling the fitting process.

  • eps - Positive convergence tolerance. Smaller values of eps provide better parameter estimates, but also reduce the probability of the iterations converging. In case of issues with convergence, test larger values of eps. Default is 10^-5.

  • denom.eps - Default is 10^-20.

  • itmax - Integer giving the maximum number of iterations. Default is 200.

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 Moran's I. Default is 1.

plot

A logical value indicating whether to plot autocorrelation of residuals by distance bin. NOW DEPRECATED in favor of plot.WRM method.

customize_plot

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

x

An object of class GEE or WRM

...

Not used

object

An object of class WRM

newdata

A data frame containing variables used to make predictions.

sm

Logical. Should part of smooth components be included?

newcoord

New coordinates corresponding to observations in newdata.

Details

WRM can be used to fit linear models for response vectors of different distributions: gaussian, binomial, or poisson. As a spatial model, it is a generalized linear model in which the residuals may be autocorrelated. It corrects for 2-dimensional residual autocorrelation for regular gridded data sets using the wavelet decomposition technique. The grid cells are assumed to be square. Furthermore, this function requires that all predictor variables be continuous.

Value

An object of class WRM. This consists of a list with the following elements:

call

Call

formula

Model formula

family

Family

coord

Coordinates used in the model

b

Estimate of regression parameters

s.e.

Standard errors

z

Depending on the family, either a z or t value

p

p-values

fitted

Fitted values from the model

resid

Pearson residuals

b.sm

Parameter estimates of neglected smooth part

fitted.sm

Fitted values of neglected smooth part

level

Selected level of wavelet decomposition

wavelet

Selected wavelet

wtrafo

Selected wavelet transformation

padzone

Selected padding zone expansion factor

padform

Selected matrix padding type

n.eff

Effective number of observations

AIC

Akaike information criterion

AICc

AIC score corrected for small sample sizes

LogLik

Log likelihood of the model

ac.glm

Autocorrelation of GLM residuals

ac.wrm

Autocorrelation of WRM residuals

b.ini

Initial parameter values

control

Control parameters for the fitting process

moran.params

Parameters for calculating Moran's I

pad

List of parameters for padding wavelet coefficients

plot

An object of class ggplot containing information on the autocorrelation of residuals from the fitted WRM and a GLM

Note

For those interested in multimodel inference approaches, WRM with level = 1 is identical to mmiWMRR with scale = 1.

Author(s)

Gudrun Carl, Sam Levin

References

Carl, G., Kuehn, I. (2010): A wavelet-based extension of generalized linear models to remove the effect of spatial autocorrelation. Geographical Analysis 42 (3), 323 - 337

Whitcher, B. (2005) Waveslim: basic wavelet routines for one-, two- and three-dimensional signal processing. R package version 1.5.

See Also

mmiWMRR, predict.WRM, summary.WRM, aic.calc

Examples

data(musdata)
coords <- musdata[,4:5]

## Not run: 
mwrm <- WRM(musculus ~ pollution + exposure,
            family = "poisson",
            data = musdata,
            coord = coords,
            level = 1)

pred <- predict(mwrm, newdata = musdata)

summary(mwrm)

plot(mwrm)

library(ggplot2)

my_wrm_plot <- mwrm$plot

# increase axis text size
print(my_wrm_plot + ggplot2::theme(axis.text = element_text(size = 15)))


## End(Not run)


[Package spind version 2.2.1 Index]