GeoTestIndependence: Parametric bootstrap test for absence of spatial dependence

View source: R/GeoTestIndependence.R

GeoTestIndependenceR Documentation

Parametric bootstrap test for absence of spatial dependence

Description

Performs a parametric bootstrap likelihood-ratio test of spatial independence against a spatially dependent random-field model. Under the null hypothesis, the observations at distinct sites are fitted using the marginal independence likelihood. Under the alternative hypothesis, a full spatial likelihood is fitted with the nugget proportion estimated below its independence boundary. The bootstrap is required because the null hypothesis corresponds to a boundary point and the spatial correlation parameters are not identified under the null.

Usage

GeoTestIndependence(data, coordx,
 start, fixed = NULL,
 corrmodel = "Matern",
 model = "Gaussian",
 optimizer = "bobyqa",
 optimizer_ind = "Nelder-Mead",
 lower = NULL, upper = NULL,
 X = NULL, n = 1,
 distance = "Eucl", radius = 1,
 anisopars = NULL,
 est.aniso = c(FALSE, FALSE),
 sparse = FALSE,
 B = 1000,
 parallel = TRUE,
 ncores = NULL,
 progress = TRUE,
 seed = NULL)

Arguments

data

Numeric vector of observations.

coordx

Matrix or object coercible to a matrix containing the spatial coordinates. The number of rows must equal length(data). Duplicate locations are not allowed.

start

Non-empty named list containing the parameters to be estimated under the spatial alternative. It must include, either directly or through fixed, all parameters required by model and corrmodel. The parameter nugget is always estimated under the alternative; if it is supplied in fixed, it is automatically moved to start.

fixed

Optional named list containing parameters kept fixed under the spatial alternative. Parameters cannot occur in both start and fixed.

corrmodel

Correlation model used under the spatial alternative. The default is "Matern".

model

Marginal model for the observations. The default is "Gaussian".

optimizer

Optimization method passed to GeoFit for the full spatial fit under H_1. The default is "bobyqa".

optimizer_ind

Optimization method used for the marginal independence fit under H_0. The default is "Nelder-Mead". If the requested method fails, the function also tries "Nelder-Mead" as a fallback and retains the successful fit with the largest finite log-likelihood.

lower, upper

Optional named lists of lower and upper bounds for the parameters estimated under the spatial alternative. Names must refer only to parameters in start, after the possible promotion of nugget from fixed. The upper bound for nugget must be one, or omitted, so that the independence model belongs to the closure of the alternative.

X

Optional design matrix for the mean or marginal regression model. Its number of rows must equal length(data).

n

Model-specific parameter passed to GeoFit and GeoSim. The default is 1.

distance

Distance metric passed to GeoFit, GeoDistances, and GeoSim. The default is "Eucl".

radius

Positive radius used for spherical or geodesic distances. The default is 1.

anisopars

Optional list of anisotropy parameters passed to the spatial fit under the alternative.

est.aniso

Logical vector of length two indicating whether the anisotropy angle and ratio are estimated under the alternative. The default is c(FALSE, FALSE).

sparse

Logical value passed to the full-likelihood spatial fit. The default is FALSE.

B

Number of parametric bootstrap replications. The default is 1000. Values below 99 produce a coarse bootstrap p-value and generate a warning.

parallel

Logical value indicating whether the bootstrap fits should be evaluated in parallel when the required packages are available.

ncores

Number of worker processes. If NULL, the value is chosen automatically from the available cores and the requested number of bootstrap replications.

progress

Logical value indicating whether progress bars should be displayed through progressr.

seed

Optional finite numeric seed. When supplied, the previous global random-number-generator state is restored when the function exits.

Details

The test compares

H_0: \text{absence of spatial dependence}

with

H_1: \text{a spatially dependent random-field model}.

Under H_0, the function fits GeoFit(..., likelihood = "Marginal", type = "Independence"). Only marginal and regression parameters are estimated. Spatial correlation parameters and the nugget proportion are absent from the null fit because they are not identified under independence. The null fit uses optimizer_ind; if necessary, a "Nelder-Mead" fallback is attempted. The optimizer associated with the selected null fit is returned in optimizer_independence.

Under H_1, the function fits GeoFit(..., likelihood = "Full", type = "Standard") using corrmodel. The nugget parameter is estimated on [0,1). Independence is represented by the boundary \texttt{nugget}=1, where the spatial correlation contribution vanishes. The upper optimization bound is internally set to a value immediately below one because GeoFit requires nugget < 1.

The observed likelihood-ratio statistic is

\Lambda_{obs}=2\{\ell_1-\ell_0\},

where \ell_0 is the maximized independence log-likelihood and \ell_1 is the maximized full spatial log-likelihood. If the unrestricted spatial fit reaches the independence boundary, the statistic is set to zero and the function returns pvalue = 1 without running the bootstrap.

The usual chi-squared likelihood-ratio approximation is not used because the null value is on the boundary and the spatial correlation parameters are not identified under H_0. Instead, the null distribution is approximated by parametric bootstrap. The bootstrap p-value is

\widehat p = \frac{1+\sum_{b=1}^{B_{valid}} I(\Lambda_b^*\geq\Lambda_{obs})} {B_{valid}+1}.

Bootstrap datasets are generated exactly independently at the observed sites. Because GeoSim does not accept nugget = 1, the implementation uses an auxiliary GenWend correlation model with compact support equal to one half of the minimum inter-site distance. Consequently, all off-diagonal correlations at the observed locations are exactly zero. This auxiliary model is used only as a simulation device; the fitted null model remains the marginal independence model.

The observed parameter estimates are used as starting values in the bootstrap refits. If the first spatial fit fails to attain at least the independence log-likelihood, adaptive fallback fits are attempted using alternative initial values for nugget. When the best spatial fit is numerically equivalent to the null fit, the bootstrap statistic is treated as a boundary value equal to zero.

When parallel = TRUE, bootstrap fits are evaluated with future.apply. Each simulated dataset is written temporarily to a separate RDS file so that workers do not receive the complete simulation object. The user's previous future plan, progressr handlers, and random-number- generator state are restored on exit.

The current implementation is restricted to univariate models with a single nugget proportion named nugget. It compares the independence likelihood only with the full spatial likelihood. It does not directly compare the independence likelihood with a pairwise composite likelihood, because the two criteria are not on the same scale.

Value

An invisible list with components:

lambda_obs

Observed likelihood-ratio statistic.

pvalue

Parametric bootstrap p-value.

nugget_hat

Estimated nugget proportion under the spatial alternative.

boundary_observed

Logical value indicating whether the unrestricted spatial fit was classified as an independence-boundary solution.

optimizer_independence

Optimizer used by the selected independence fit under H_0. This can differ from optimizer_ind when the "Nelder-Mead" fallback is selected.

optimizer_spatial

Optimizer used for the full spatial fit under H_1.

seed

Seed supplied by the user, or NULL.

B_requested

Requested number of bootstrap replications.

bootstrap_successful

Number of valid bootstrap replications.

bootstrap_failed

Number of failed bootstrap replications.

bootstrap_success_rate

Fraction of successful bootstrap replications. This is NA when the observed statistic is zero and the bootstrap is not run.

fallback_observed

Logical value indicating whether adaptive starting values were required for the observed spatial fit.

fallback_bootstrap

Number of bootstrap replications in which adaptive starting values were used for the spatial fit.

boundary_bootstrap

Number of valid bootstrap replications classified as independence-boundary solutions.

simulation_support

Compact-support value used by the auxiliary GenWend model to simulate independent observations. This component is absent when the observed statistic is zero and the bootstrap is skipped.

B_rep

Vector of valid bootstrap likelihood-ratio statistics.

fit_H0

GeoFit object fitted under spatial independence.

fit_H1

GeoFit object fitted under the spatial alternative.

Note

For Gaussian random fields, the null hypothesis is equivalent to mutual independence of the observations at distinct spatial locations. For non-Gaussian models, the interpretation as independence requires that zero latent spatial dependence imply independence in the corresponding observed random-field construction.

A small bootstrap p-value indicates evidence of spatial dependence. For final analyses, a value such as B = 999 or larger is recommended.

Author(s)

Moreno Bevilacqua moreno.bevilacqua89@gmail.com https://sites.google.com/view/moreno-bevilacqua/home

See Also

GeoFit, GeoSim, GeoDistances, GeoTestsupp_space, GeoTestIsotropy

Examples

## Not run: 
library(GeoModels)

set.seed(3)
N <- 300
coords <- cbind(runif(N), runif(N))

X <- cbind(1, runif(N))

param <- list(
  mean = 0.2,
  mean1 = -0.5,
  sill = 1,
  nugget = 0,
  scale = 0.2 / 3,
  smooth = 0.5
)

data <- GeoSim(
  coordx = coords,
  corrmodel = "Matern",
  model = "Gaussian",
  param = param,
  X = X
)$data

start <- list(
  mean = 0,
  mean1 = 0,
  sill = 1,
  nugget = 0.1,
  scale = 0.1
)

fixed <- list(smooth = 0.5)

lower <- list(
  mean = -Inf,
  mean1 = -Inf,
  sill = 1e-6,
  nugget = 0,
  scale = 1e-6
)

upper <- list(
  mean = Inf,
  mean1 = Inf,
  sill = Inf,
  nugget = 1,
  scale = 1
)

ans <- GeoTestIndependence(
  data = data,
  coordx = coords,
  X = X,
  start = start,
  fixed = fixed,
  corrmodel = "Matern",
  model = "Gaussian",
  optimizer = "bobyqa",
  optimizer_ind = "Nelder-Mead",
  lower = lower,
  upper = upper,
  B = 199,
  parallel = TRUE,
  seed = 123
)

ans$pvalue
ans$lambda_obs
ans$nugget_hat
ans$bootstrap_success_rate

## End(Not run)

GeoModels documentation built on July 29, 2026, 5:06 p.m.