View source: R/GeoTestsupp_space.R
| GeoTestsupp_space | R Documentation |
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.
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)
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 |
start |
Non-empty named list containing parameters to be estimated.
Together with |
fixed |
Named list containing parameters kept fixed, or |
model |
Marginal model passed to |
h0 |
Positive finite threshold defining
|
optimizer |
Optimization method passed to |
lower, upper |
Named lists containing bounds for parameters in
|
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 |
B |
Positive integer giving the requested number of parametric
bootstrap replications. Default is |
likelihood |
Likelihood passed to |
type |
Likelihood type passed to |
method |
Simulation method used under the fitted null model.
|
L |
Number of spectral components used by |
parallel |
Logical value indicating whether bootstrap fits should be evaluated in parallel when the required packages are available. |
ncores |
Number of workers. If |
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. |
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.
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 |
method |
Simulation method used. |
L |
Number of turning-bands components when |
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 |
fit_H1 |
Fitted |
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.
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.
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
GeoFit, GeoSim,
GeoSimapprox, GeoTestIndependence,
GeoTestIsotropy, GeoTests
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.