LuTest: Nonparametric Test of Symmetry Using the Periodogram

Description Usage Arguments Details Value References See Also Examples

Description

This function performs the nonparametric tests of reflection and complete symmetry using the periodogram from Lu and Zimmerman (2005) for spatial data with sampling locations on the integer grid. See Lu and Zimmerman (2005) for more details.

Usage

1
LuTest(spdata, nrows = 10, ncols = 10, test = "complete", nsim = 5000)

Arguments

spdata

An n x 3 matrix. The first two columns provide (x,y) spatial coordinates. The third column provides data values at the coordinates. This argument can also be an object of class geodata from the package geoR, or of class SpatialGridDataFame or SpatialPixelsDataFame from the package sp. If the class is SpatialPixelsDataFame, then the parameters nrows and ncols are extracted from the grid attributes.

nrows

The number of rows of observed data.

ncols

The number of columns of observed data.

test

A string taking the value reflection or complete for a test of reflection or complete symmetry. If test = "complete", a test for complete symmetry is performed after a test of reflection symmetry is performed and both p-values are returned.

nsim

The number simulations used to approximate the sampling distribution of CvM and CvM* from Lu ad Zimmerman (2005).

Details

The function assumes data are on the integer grid, Z-squared. It uses the (unsmoothed) periodogram, the Fourier transform of the sample covariance function, to test symmetry properties.

Value

pvalue.refl

The p-value for the test of reflection symmetry computed by the CvM GoF test.

pvalue.comp

If test = "complete", the p-value for the test of complete symmetry computed by using the CvM* GoF test.

References

Lu, N., & Zimmerman, D. L. (2005). Testing for directional symmetry in spatial dependence using the periodogram. Journal of Statistical Planning and Inference, 129(1), 369-385.

See Also

GuanTestGrid

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
39
40
41
42
43
library(mvtnorm)
set.seed(1)
#Number of rows and columns
nr <- 15
nc <- 15
n <- nr*nc
#Set up the coordinates
coords <- expand.grid(0:(nr-1), 0:(nc-1))
coords <- cbind(coords[,2], coords[,1])
#Compute the distance between sampling locations
D <- as.matrix(dist(coords))
#Set parameter values for exponential covariance function
sigma.sq <- 1
tau.sq <- 0.0
phi <- 1/4
#Simulate data using isotropic covariance function
D <- as.matrix(dist(coords))
R <- sigma.sq * exp(-phi*D)
R <- R + diag(tau.sq, nrow = n, ncol = n)
z <- rmvnorm(1,rep(0,n), R, method = c("chol"))
z <-  z-mean(z)
z <- t(z)
mydata <- cbind(coords, z)
#Run the test on the data from an isotropic (symmetric) covariance function
tr <- LuTest(mydata, nr, nc, test = "complete", nsim = 1000)
tr

library(geoR)
#Simulate data from anisotropic (non-symmetric) covariance function
aniso.angle <- pi/4
aniso.ratio <- 2
coordsA <- coords.aniso(coords, c(aniso.angle, aniso.ratio))
Da <- as.matrix(dist(coordsA))
R <- sigma.sq * exp(-phi*Da)
R <- R + diag(tau.sq, nrow = n, ncol = n)
z <- rmvnorm(1,rep(0,n), R, method = c("chol"))
z <-  z-mean(z)
z <- t(z)
mydata <- cbind(coords, z)
#Run the test on the data generated from an anisotropic 
#(and non reflection and non completely symmetric) covariance function
tr <- LuTest(mydata, nr, nc, test = "complete", nsim = 1000)
tr

spTest documentation built on May 2, 2019, 8:27 a.m.

Related to LuTest in spTest...