scaleWMRR: Scaling by wavelet multiresolution regression (WMRR)

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/scale_WMRR.R

Description

scaleWMRR performs a scale-specific regression based on a wavelet multiresolution analysis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
scaleWMRR(
  formula,
  family,
  data,
  coord,
  scale = 1,
  detail = TRUE,
  wavelet = "haar",
  wtrafo = "dwt",
  b.ini = NULL,
  pad = list(),
  control = list(),
  moran.params = list(),
  trace = FALSE
)

Arguments

formula

With specified notation according to names in data frame.

family

gaussian, binomial, or poisson.

data

Data frame.

coord

Corresponding coordinates which have to be integer.

scale

0 (which is equivalent to GLM) or higher integers possible (limit depends on sample size).

detail

Remove smooth wavelets? If TRUE, only detail components are analyzed. If set to FALSE, smooth and detail components are analyzed. Default is TRUE.

wavelet

Type of wavelet: haar or d4 or la8

wtrafo

Type of wavelet transform: dwt or modwt.

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 the formula includes an intercept and has 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.

trace

A logical value indicating whether to print parameter estimates to the console

Details

This function fits generalized linear models while taking the two-dimensional grid structure of datasets into account. The following error distributions (in conjunction with appropriate link functions) are allowed: gaussian, binomial, or poisson. The model provides scale-specific results for data sampled on a contiguous geographical area. The dataset is assumed to be regular gridded and the grid cells are assumed to be square. A function from the package 'waveslim' is used for the wavelet transformations (Whitcher, 2005). Furthermore, this function requires that all predictor variables be continuous.

Value

scaleWMRR returns a list containing the following elements

call

Model call

b

Estimates of regression parameters

s.e.

Standard errors of the parameter estimates

z

Z values (or corresponding values for statistics)

p

p-values for each parameter estimate

df

Degrees of freedom

fitted

Fitted values

resid

Pearson residuals

converged

Logical value whether the procedure converged

trace

Logical. If TRUE:

Author(s)

Gudrun Carl

References

Carl G, Doktor D, Schweiger O, Kuehn I (2016) Assessing relative variable importance across different spatial scales: a two-dimensional wavelet analysis. Journal of Biogeography 43: 2502-2512.

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

See Also

waveslim,mra.2d

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
data(carlinadata)
coords <- carlinadata[ ,4:5]

## Not run: 

# scaleWMRR at scale = 0 is equivalent to GLM

ms0 <- scaleWMRR(carlina.horrida ~ aridity + land.use,
                 family = "poisson",
                 data = carlinadata,
                 coord = coords,
                 scale = 0,
                 trace = TRUE)

# scale-specific regressions for detail components
ms1 <- scaleWMRR(carlina.horrida ~ aridity + land.use,
                 family = "poisson",
                 data = carlinadata,
                 coord = coords,
                 scale = 1,
                 trace = TRUE)

ms2 <- scaleWMRR(carlina.horrida ~ aridity + land.use,
                 family = "poisson",
                 data = carlinadata,
                 coord = coords,
                 scale = 2,
                 trace = TRUE)

ms3<- scaleWMRR(carlina.horrida ~ aridity + land.use,
                 family = "poisson",
                 data = carlinadata,
                 coord = coords,
                 scale = 3,
                 trace = TRUE)


## End(Not run)

spind documentation built on Jan. 13, 2021, 6:04 p.m.