Skip to contents

Test the spatial heterogeneity in data based on permutation.

Usage

spatial_hetero_test(
  x,
  coords,
  ...,
  resample = 5000,
  poly = 2,
  bw = 10,
  kernel = c("bisquared", "gaussian"),
  verbose = 0
)

Arguments

x

A matrix of data to be tested. Each column is a variable.

coords

A matrix of coordinates.

...

Additional arguments.

resample

The total times of resampling with replacement. Default to 5000.

poly

The number of polynomial terms used by the polynomial estimator. Default to 2.

bw

The adaptive bandwidth used by the polynomial estimator. Default to 10.

kernel

The kernel function used by the polynomial estimator.

verbose

The verbosity level. Default to 0.

Value

A shgt object of permutation-test results with the following items:

vars

The names of variables.

t0

The value of the statistics (variance of density estimation) on original values.

t

The value of the same statistics on permuted values.

p

The p-value for each variable.

Examples

data(multisampling.large)
spatial_hetero_test(multisampling.large$beta, multisampling.large$coords)
#> Spatial Heterogeneity Test
#> 
#>                  t0                   t Pr(t>t0)    
#> Intercept  0.081540 [0.031470,0.239609] 0.778200    
#> g1        29.266000 [1.045108,6.264079] 0.000000 ***
#> g2        21.339481 [0.759496,4.698393] 0.000000 ***
#> z1         0.110370 [0.034536,0.213022] 0.298600    
#> x1         0.000000 [0.000000,0.000000] 0.000000 ***
#> 
#> 
#> Significance levels: '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' '
#>