mapcomp performs a spatial pattern analysis based on the calculation of a formal distance (the Hellinger distance) between the density map of count or incidence data, and the density map of sampling effort. Statistical tests of spatial homogeneity are based on permutations across sampling sites and on valuable properties of the Hellinger distance.

mapcomp(data, ...)

# S3 method for data.frame
mapcomp(data, delta, bandwidth, nperm = 100,
edge_correction = FALSE, threads = 1, verbose = TRUE, ...)

# S3 method for matrix
mapcomp(data, delta, bandwidth, nperm = 100,
edge_correction = FALSE, threads = 1, verbose = TRUE, ...)

# S3 method for count
mapcomp(data, delta, bandwidth, nperm = 100,
edge_correction = FALSE, threads = 1, verbose = TRUE, ...)

# S3 method for incidence
mapcomp(data, delta, bandwidth, nperm = 100,
edge_correction = FALSE, threads = 1, verbose = TRUE, ...)

## Arguments

data A data frame or a matrix with only three columns: the two first ones must be the x and y coordinates of the sampling units, and the last one, the corresponding disease intensity observations. It can also be a count or an incidence object. Additional arguments to be passed to other methods. Mesh size of the grid over the geographical domain of the sampling units used to compute the integral Hellinger distance between the probability density function of observations and the probability density function of sampling effort. Bandwidth parameter for smoothing. It allows to test the spatial extent of heterogeneity if any. Number of random permutations to assess probabilities. Apply edge correction to account for the fact that bordering points intrinsically suffer from a lack of neighboring observation sites. FALSE by default. Number of threads to perform the computations. Explain what is being done (TRUE by default).

## References

Lavigne C, Ricci B, Franck P, Senoussi R. 2010. Spatial analyses of ecological count data: A density map comparison approach. Basic and Applied Ecology. 11:734–742.

## Examples

set.seed(123)
my_res <- mapcomp(codling_moths, delta = 1, bandwidth = 11,
edge_correction = FALSE, nperm = 20)#>
|                                                  | 0 % ~calculating
|+++                                               | 5 % ~08s
|+++++                                             | 10% ~05s
|++++++++                                          | 15% ~03s
|++++++++++                                        | 20% ~02s
|+++++++++++++                                     | 25% ~02s
|+++++++++++++++                                   | 30% ~02s
|++++++++++++++++++                                | 35% ~01s
|++++++++++++++++++++                              | 40% ~01s
|+++++++++++++++++++++++                           | 45% ~01s
|+++++++++++++++++++++++++                         | 50% ~01s
|++++++++++++++++++++++++++++                      | 55% ~01s
|++++++++++++++++++++++++++++++                    | 60% ~01s
|+++++++++++++++++++++++++++++++++                 | 65% ~01s
|+++++++++++++++++++++++++++++++++++               | 70% ~00s
|++++++++++++++++++++++++++++++++++++++            | 75% ~00s
|++++++++++++++++++++++++++++++++++++++++         | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++       | 85% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++    | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++  | 95% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 01smy_res#> Map Comparison analysis (mapcomp)
#>
#> Call:
#> mapcomp.data.frame(data = codling_moths, delta = 1, bandwidth = 11,
#>     nperm = 20, edge_correction = FALSE)
#>
#> Stat: 0.3423 (P = 0.047619)
#> plot(my_res)
set.seed(123)
my_count <- count(codling_moths, mapping(x = xm, y = ym))
my_res <- mapcomp(my_count, delta = 1, bandwidth = 11,
edge_correction = FALSE, nperm = 20)#>
|                                                  | 0 % ~calculating
|+++                                               | 5 % ~01s
|+++++                                             | 10% ~01s
|++++++++                                          | 15% ~01s
|++++++++++                                        | 20% ~01s
|+++++++++++++                                     | 25% ~01s
|+++++++++++++++                                   | 30% ~01s
|++++++++++++++++++                                | 35% ~01s
|++++++++++++++++++++                              | 40% ~01s
|+++++++++++++++++++++++                           | 45% ~01s
|+++++++++++++++++++++++++                         | 50% ~01s
|++++++++++++++++++++++++++++                      | 55% ~00s
|++++++++++++++++++++++++++++++                    | 60% ~00s
|+++++++++++++++++++++++++++++++++                 | 65% ~00s
|+++++++++++++++++++++++++++++++++++               | 70% ~00s
|++++++++++++++++++++++++++++++++++++++            | 75% ~00s
|++++++++++++++++++++++++++++++++++++++++         | 80% ~00s
|+++++++++++++++++++++++++++++++++++++++++++       | 85% ~00s
|+++++++++++++++++++++++++++++++++++++++++++++    | 90% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++  | 95% ~00s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 01smy_res#> Map Comparison analysis (mapcomp)
#>
#> Call:
#> mapcomp.count(data = my_count, delta = 1, bandwidth = 11, nperm = 20,
#>     edge_correction = FALSE)
#>
#> Stat: 0.3423 (P = 0.047619)
#> plot(my_res, bins = 10)