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 |
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. |
level |
An integer specifying the degree of wavelet decomposition
|
wavelet |
Name of wavelet family. |
wtrafo |
Type of wavelet transform. Either |
b.ini |
Initial parameter values. Default is NULL. |
pad |
A list of parameters for padding wavelet coefficients.
|
control |
a list of parameters for controlling the fitting process.
|
moran.params |
A list of parameters for calculating Moran's I.
|
plot |
A logical value indicating whether to plot autocorrelation of
residuals by distance bin. NOW DEPRECATED in favor of |
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 used to make predictions. |
sm |
Logical. Should part of smooth components be included? |
newcoord |
New coordinates corresponding to observations in |
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 valuep
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 fittedWRM
and aGLM
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)