View source: R/appl_localcor.r

GET.localcor | R Documentation |

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

```
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,
...
)
```

`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 |

`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 |

`bandwidth.h` |
Non-varying bandwidth, to be passed to the argument |

`maxk` |
See |

`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 |

`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 |

`mc.args` |
A named list of additional arguments to be passed to |

`cl` |
Allows parallelization through the use of |

`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 |

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.

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`

).

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, T., Myllymäki, M. (2023) False discovery rate envelopes. Statistics and Computing 33, 109. https://doi.org/10.1007/s11222-023-10275-7

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.