hmwCorr: Dutilleul moving window bivariate raster correlation

Description Usage Arguments Value Note Author(s) References Examples

Description

A bivarate raster corrlation using Dutilleul's modified t-test

Usage

1
2
hmwCorr(x, y, x.idx = 1, y.idx = 1, d = "AUTO", sub.sample = FALSE,
  type = "hexagon", p = 0.1, size = NULL)

Arguments

x

x raster for correlation, SpatialPixelsDataFrame or SpatialGridDataFrame object

y

y raster for correlation, SpatialPixelsDataFrame or SpatialGridDataFrame object

x.idx

Index for the column in the x raster object

y.idx

Index for the column in the y raster object

d

Distance for finding neighbors

sub.sample

Should a subsampling approach be employed (TRUE/FALSE)

type

If sub.sample = TRUE, what type of sample (random or hexagon)

p

If sub.sample = TRUE, what proportion of population should be sampled

size

Fixed sample size

Value

A SpatialPixelsDataFrame or SpatialPointsDataFrame with the following attributes:

Note

This function provides a bivariate moving window correlation using the modified t-test to account for spatial autocorrelation. Point based subsampling is provided for computation tractability. The hexagon sampleing is recomended as it it good at capturing spatial process that includes nonstationarity and anistropy.

Author(s)

Jeffrey S. Evans <[email protected]>

References

Clifford, P., S. Richardson, D. Hemon (1989), Assessing the significance of the correlation between two spatial processes. Biometrics 45:123-134. Dutilleul, P. (1993), Modifying the t test for assessing the correlation between two spatial processes. Biometrics 49:305-314.

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
## Not run: 
library(gstat)                                         
library(sp)                                            
                                                        
data(meuse)                                            
data(meuse.grid)                                       
coordinates(meuse) <- ~x + y                           
coordinates(meuse.grid) <- ~x + y                      
                                                        
# GRID-1 log(copper):                                              
v1 <- variogram(log(copper) ~ 1, meuse)                  
x1 <- fit.variogram(v1, vgm(1, "Sph", 800, 1))           
G1 <- krige(zinc ~ 1, meuse, meuse.grid, x1, nmax = 30)
gridded(G1) <- TRUE                                      
G1@data = as.data.frame(G1@data[,-2])

# GRID-2 log(elev):                                              
v2 <- variogram(log(elev) ~ 1, meuse)                  
x2 <- fit.variogram(v2, vgm(.1, "Sph", 1000, .6))        
G2 <- krige(elev ~ 1, meuse, meuse.grid, x2, nmax = 30)
gridded(G2) <- TRUE    
G2@data <- as.data.frame(G2@data[,-2])
G2@data[,1] <- G2@data[,1]

corr <- mwCorr(G1, G2)	  
corr.hex <- mwCorr(G1, G2, sub.sample = TRUE)	
corr.rand <- mwCorr(G1, G2, sub.sample = TRUE, type = "random")	

corr.hex <- mwCorr(G1, G2, sub.sample = TRUE, d = 500, size = 1000)	
  head(corr.hex@data)
  bubble(corr.hex, "corr")

## End(Not run)

jeffreyevans/spatialEco documentation built on Jan. 22, 2019, 3:19 p.m.