GeoTestsupp_space: Parametric Bootstrap Test for Spatial Support

View source: R/GeoTestsupp_space.R

GeoTestsupp_spaceR Documentation

Parametric Bootstrap Test for Spatial Support

Description

Performs a parametric bootstrap likelihood-ratio test for the spatial scale, interpreted as the compact-support radius of the "GenWend" correlation model. The null model either constrains the scale by \mathrm{scale} \le h_0 or, when h0 = NULL, represents spatial independence by fixing the support below the minimum observed inter-site distance. The alternative estimates the scale without the null upper constraint.

Usage

GeoTestsupp_space(data, coordx,
 start, fixed,
 model = "Gaussian",
 h0 = NULL,
 optimizer = "bobyqa",
 lower = NULL, upper = NULL,
 neighb = 5,
 B = 10000,
 likelihood = NULL,
 type = NULL,
 method = c("cholesky", "TB"),
 L = 10000,
 parallel = TRUE,
 ncores = NULL,
 progress = TRUE,
 seed = NULL)

Arguments

data

Numeric vector containing the spatial observations. Missing or non-finite values are not allowed.

coordx

Numeric matrix whose rows contain the spatial coordinates. Its number of rows must equal length(data). Duplicated locations are not allowed because the minimum inter-site distance must be positive.

start

Non-empty named list containing parameters to be estimated. Together with fixed, it must contain exactly the parameters returned by CorrParam("GenWend") and NuisParam(model).

fixed

Named list containing parameters kept fixed, or NULL. A parameter cannot appear in both start and fixed. If scale is supplied in fixed, it is internally moved to the estimated-parameter list for construction of the unrestricted model.

model

Marginal model passed to GeoFit. Default is "Gaussian".

h0

Positive finite threshold defining H_0:\mathrm{scale}\le h_0. If NULL, the support is fixed at max(1e-6, d_min - 1e-6), where d_{min} is the minimum inter-site distance. This removes dependence among the sampled locations; for Gaussian random fields it is equivalent to independence of the sampled observations. It should not be confused with the process-level null hypothesis tested by GeoTestIndependence.

optimizer

Optimization method passed to GeoFit. Default is "bobyqa".

lower, upper

Named lists containing bounds for parameters in start. Missing bounds are replaced internally by finite fallback bounds. The null upper bound for scale is always reimposed after any numerical widening of the parameter box.

neighb

Number of nearest neighbors used for pairwise composite likelihood. It is ignored for full likelihood. When full likelihood is selected automatically, it is internally set to NULL.

B

Positive integer giving the requested number of parametric bootstrap replications. Default is 10000. Values below 99 are allowed but generate a warning because they give a coarse bootstrap p-value.

likelihood

Likelihood passed to GeoFit. Supported values are "Full", "Marginal", and "Conditional". Either both likelihood and type must be supplied, or both must be NULL.

type

Likelihood type passed to GeoFit. Full likelihood must use "Standard"; marginal or conditional composite likelihood must use "Pairwise".

method

Simulation method used under the fitted null model. "cholesky" calls GeoSim; "TB" calls GeoSimapprox.

L

Number of spectral components used by GeoSimapprox when method = "TB". Default is 10000. Ignored for Cholesky simulation.

parallel

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

ncores

Number of workers. If NULL, the value is selected automatically from the available cores and the number of bootstrap replications.

progress

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

seed

Optional finite numeric seed. When supplied, the test is reproducible and the user's previous random-number-generator state is restored when the function exits.

Details

The correlation model is fixed internally to "GenWend". Therefore, the parameter called scale is interpreted as the compact-support radius.

Likelihood selection. When both likelihood and type are NULL, the function uses full likelihood with type = "Standard" for at most 2000 observations, and marginal pairwise composite likelihood for larger datasets. User-supplied combinations are checked for consistency.

Null and alternative models. For a numeric h0, the null model estimates scale subject to \mathrm{scale}\le h_0, while the unrestricted model uses a data-dependent upper bound strictly larger than h0. For h0 = NULL, the null model fixes the support radius just below the minimum observed inter-site distance. Since the generalized Wendland correlation is compactly supported, all distinct observations are then uncorrelated under the null model.

The lower bound under the alternative must be smaller than h0, and its upper bound must be larger than h0, so that the null parameter space is nested in the alternative. The function stops if these conditions are not satisfied.

Likelihood-ratio statistic. Let \ell_0 and \ell_1 denote the fitted log-likelihood or log-composite-likelihood values under the null and unrestricted models. The observed statistic is

\Lambda_{\mathrm{obs}} = 2(\ell_1-\ell_0).

Tiny negative differences attributable to numerical tolerance are set to zero. A materially smaller unrestricted likelihood is treated as an optimization failure rather than automatically converted to a zero statistic.

For pairwise composite likelihood, the function verifies that the null and unrestricted fits use identical rowidx and colidx pair sets. A likelihood-ratio comparison based on different pair sets is not accepted.

Adaptive unrestricted-fit fallback. The unrestricted model is first fitted once using the primary starting values. Only if this fit fails or returns a likelihood smaller than the null likelihood beyond numerical tolerance is a second fit attempted. The fallback starts from the fitted null parameters and places scale slightly above h0. The better valid unrestricted fit is retained. The same adaptive rule is used for each bootstrap dataset.

Parametric bootstrap. Bootstrap datasets are simulated from the fitted null model. Each dataset is refitted under both hypotheses, using the observed null and unrestricted estimates as starting values. Replications with failed fits, incompatible pair sets, non-finite likelihoods, or an unresolved ordering \ell_1 < \ell_0 are discarded. If B_{\mathrm{valid}} replications are successful, the bootstrap p-value is

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

At least min(20, B) valid replications are required. A warning is issued when fewer than 80 percent of the requested replications are successful.

Early exit. If the unrestricted estimate itself satisfies the null constraint, the likelihood-ratio statistic is zero and the function returns pvalue = 1 without running the bootstrap.

Parallel computation. For method = "TB", simulation may use parallel computation inside GeoSimapprox. Bootstrap refits are performed in a separate phase. In the parallel bootstrap, each simulated dataset is written to a separate RDS file so that each worker reads only its own replicate. The user's future plan, progressr handlers, RNG state, and temporary files are restored or removed on exit.

Value

An invisible list. When the bootstrap is run, it contains:

d_min

Minimum inter-site distance.

h0

Threshold actually used under the null hypothesis.

lambda_obs

Observed likelihood-ratio statistic.

pvalue

Parametric-bootstrap p-value.

seed

Seed supplied by the user, or NULL.

method

Simulation method used.

L

Number of turning-bands components when method = "TB", otherwise NULL.

B_requested

Requested number of bootstrap replications.

bootstrap_successful

Number of valid bootstrap replications.

bootstrap_failed

Number of failed or discarded bootstrap replications.

bootstrap_success_rate

Fraction of requested replications that were valid.

fallback_observed

Logical value indicating whether the adaptive unrestricted-fit fallback was used for the observed data.

fallback_bootstrap

Number of bootstrap replications in which the adaptive unrestricted-fit fallback was attempted.

B_rep

Vector of valid bootstrap likelihood-ratio statistics.

fit_H0

Fitted GeoFit object under the null hypothesis.

fit_H1

Fitted GeoFit object under the unrestricted alternative.

For an early exit, lambda_obs = 0, pvalue = 1, bootstrap_successful = 0, bootstrap_success_rate = NA, and B_rep is empty. In the current implementation, L and bootstrap_failed are omitted from this early-return object.

Note

The test concerns the compact-support radius of the generalized Wendland correlation model and is not a generic range-parameter test for arbitrary correlation functions. For final inference, a substantially larger value of B than that used in quick examples is recommended.

Author(s)

Moreno Bevilacqua moreno.bevilacqua89@gmail.com https://sites.google.com/view/moreno-bevilacqua/home
Victor Morales Onate victor.morales@uv.cl https://sites.google.com/site/moralesonatevictor/
Christian Caamano-Carrillo chcaaman@ubiobio.cl https://www.researchgate.net/profile/Christian-Caamano

See Also

GeoFit, GeoSim, GeoSimapprox, GeoTestIndependence, GeoTestIsotropy, GeoTests

Examples

## Not run: 
library(GeoModels)

set.seed(123)
n <- 300
coords <- cbind(runif(n), runif(n))

param <- list(
  mean = 0,
  nugget = 0,
  sill = 1,
  scale = 0.20,
  smooth = 0.5,
  power2 = 4
)

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

start <- list(
  mean = 0,
  sill = 1,
  scale = 0.15
)
fixed <- list(
  nugget = 0,
  smooth = 0.5,
  power2 = 4
)

lower <- list(mean = -Inf, sill = 1e-6, scale = 1e-6)
upper <- list(mean = Inf, sill = Inf, scale = 1)

## Test H0: scale <= 0.10 against scale > 0.10.
ans <- GeoTestsupp_space(
  data = z,
  coordx = coords,
  start = start,
  fixed = fixed,
  h0 = 0.10,
  lower = lower,
  upper = upper,
  B = 199,
  likelihood = "Full",
  type = "Standard",
  parallel = FALSE,
  seed = 321
)

ans$pvalue
ans$lambda_obs
ans$bootstrap_success_rate

## Independence test: support fixed below the minimum inter-site distance.
ans_ind <- GeoTestsupp_space(
  data = z,
  coordx = coords,
  start = start,
  fixed = fixed,
  h0 = NULL,
  lower = lower,
  upper = upper,
  B = 199,
  likelihood = "Full",
  type = "Standard",
  parallel = FALSE,
  seed = 654
)

## End(Not run)

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