GET.localcor: The test of local correlations

View source: R/appl_localcor.r

GET.localcorR Documentation

The test of local correlations

Description

The test of local correlations using Vilodomat et al. (2014) procedure for resamples and the FDR envelope of Mrkvička and Myllymäki (2022).

Usage

GET.localcor(
  data,
  Delta,
  nsim = 1000,
  typeone = c("fdr", "fwer"),
  varying.bandwidth = FALSE,
  bandwidth.nn = 0.1,
  bandwidth.h = 5.281,
  maxk = 300,
  savefuns = FALSE,
  N_s = 1000,
  mc.cores = 1L,
  mc.args = NULL,
  cl = NULL,
  notest = FALSE,
  ...
)

Arguments

data

A data.frame where the first two columns correspond to the values of the two random fields, whose correlations are to be studied, and the third and fourth columns correspond to the x- and y-coordinates where these random fields have been observed. In addition, the width and height of the pixels at each (x,y) can be given in the fifth and sixth column. Warning: no checks for the data input.

Delta

A smoothing parameter of the local correlation. According to Vilodomat et al. (2014): Delta is a set of values for the proportion of neighbors to consider for the smoothing step. No default. The user may have to experiment with different values to find one suitable for their data.

nsim

The number of resamples.

typeone

Character string indicating which type I error rate to control, either the familywise error rate ('fwer') or false discovery rate ('fdr'). Further arguments to the FWER or FDR envelope can be passed in argument GET.args. If 'fwer', the type of the envelope can be chosen by specifying the argument type in GET.args.

varying.bandwidth

Logical, whether to use a varying bandwidth to calculate the local correlations or not. See Vilodomat et al. (2014).

bandwidth.nn

Nearest neighbor component of the smoothing parameter for varying bandwidth to be passed to the argument nn of the function lp of the locfit package. The user may have to experiment with different values to find one suitable for their data. Default set to to 0.1 according to Vilodamat et al. (2014, supporting information).

bandwidth.h

Non-varying bandwidth, to be passed to the argument h of the function lp of locfit. The user may have to experiment with different values to find one suitable for their data. Default to 5.281 according to Vilodamat et al. (2014, supporting information).

maxk

See locfit and locfit.raw of locfit. Default here to 300 following Vilodomat et al. (2014).

savefuns

Logical. If TRUE, then the functions from permutations are saved to the attribute simfuns.

N_s

If the number of observations is bigger than N_s, following Vilodomat et al. (2014) a subsample of size N_s is taken every time when a variogram is calculated.

mc.cores

The number of cores to use, i.e. at most how many child processes will be run simultaneously. Must be at least one, and parallelization requires at least two cores. On a Windows computer mc.cores must be 1 (no parallelization). For details, see mclapply, for which the argument is passed. Parallelization can be used in generating simulations and in calculating the second stage tests.

mc.args

A named list of additional arguments to be passed to mclapply. Only relevant if mc.cores is more than 1.

cl

Allows parallelization through the use of parLapply (works also in Windows), see the argument cl there, and examples.

notest

Logical. FALSE means that the test is done. TRUE allows to calculate only local correlation for the data, which can be beneficial for choosing the bandwidths before running the test. If TRUE, then only the observed local correlations will be returned.

...

Additional parameters to be passed to fdr_envelope (if typeone = "fdr") or to global_envelope_test (if typeone = "fwer").

Details

The code is a modification of the supporting information code of Vilodomat et al. (2014) available at https://doi.org/10.1111/biom.12139. The modification includes the FDR (or FWER, if specified by the argument typeone) envelopes for the test of local correlations, i.e. multiple testing correction and graphical illustration of the test results.

Variograms are calculated using the package geoR and the local correlations using the R package locfit. These packages should be installed to use GET.localcor.

Currently the data is provided in the format of Vilodomat et al. (2014, Supporting information). Additionally width and height of area represented by a data point can be provided, see the argument data. This information is used for plotting purposes when plotting the output by plot().

Examples will be provided in a vignette.

Value

A global envelope object (with possible additional classes), see description of main components in global_envelope (Value). Additional attributes: p_global contains the Monte Carlo p-value for the global test of correlation. cor_global and cor_global_sim contain the value of the correlation for data and permuted data, respectively. If savefuns = TRUE, then permutations contain the permuted values of the first random field according to Viladomat et al. (2014) procedure, and cset contains all the local correlations for the data and permuted data in a curve_set object (see create_curve_set).

References

Viladomat, J., Mazumder, R., McInturff, A., McCauley, D.J. and Hastie, T. (2014). Assessing the significance of global and local correlations under spatial autocorrelation: A nonparametric approach. Biometrics 70, 409-418. doi: 10.1111/biom.12139

Mrkvička and Myllymäki (2022). False discovery rate envelopes. arXiv:2008.10108 [stat.ME]


GET documentation built on Nov. 16, 2022, 5:09 p.m.