View source: R/GeoTestIsotropy.R
| GeoTestIsotropy | R Documentation |
Performs a parametric-bootstrap test of spatial isotropy by comparing an isotropic model under the null hypothesis with a geometrically anisotropic model under the alternative. The test statistic is a likelihood-ratio or composite-likelihood-ratio statistic, and its null distribution is estimated by simulation from the fitted isotropic model.
GeoTestIsotropy(data, coordx,
start, fixed,
optimizer = "bobyqa",
model = "Gaussian",
corrmodel = "Matern",
lower = NULL, upper = NULL,
B = 1000,
likelihood = NULL,
type = NULL,
copula = NULL,
neighb = 5,
method = c("cholesky", "TB"),
L = 10000,
parallel = TRUE,
ncores = NULL,
progress = TRUE,
seed = NULL)
data |
Numeric vector of observations. |
coordx |
Numeric matrix with exactly two columns containing the spatial
coordinates. The number of rows must equal |
start |
Named list containing the covariance and marginal parameters to
be estimated. Parameters |
fixed |
Named list containing the covariance and marginal parameters kept
fixed. Together, |
optimizer |
Optimization algorithm passed to |
model |
Marginal random-field model. |
corrmodel |
Spatial correlation model. |
lower, upper |
Named lists of lower and upper bounds for the parameters
in |
B |
Number of parametric-bootstrap replications. |
likelihood |
Likelihood type passed to |
type |
Likelihood type passed to |
copula |
Optional copula specification. When a copula is supplied, only
|
neighb |
Number of nearest neighbours used when
|
method |
Simulation method under the null hypothesis. Use
|
L |
Number of spectral components used when |
parallel |
Logical; if |
ncores |
Number of parallel workers. If |
progress |
Logical; if |
seed |
Optional finite numeric seed. The previous random-number-generator state is restored when the function exits. |
The null and alternative hypotheses are
H_0: \mathrm{ratio}=1,
and
H_1: \mathrm{ratio}>1,
with the anisotropy angle estimated under the alternative. Under H_0,
the angle is not identifiable. Consequently, the usual chi-squared reference
distribution for the likelihood-ratio statistic is not used. Instead, the
null distribution is estimated by parametric bootstrap.
The observed statistic is
T_{\mathrm{obs}}=\max\{0,2(\ell_1-\ell_0)\},
where \ell_0 and \ell_1 are the maximized likelihoods or composite
likelihoods under the isotropic and anisotropic models. Bootstrap datasets are
simulated from the fitted isotropic model, and both models are refitted to each
simulated dataset. The bootstrap p-value is
\frac{1+\sum_b I(T_b \geq T_{\mathrm{obs}})}{1+B_{\mathrm{valid}}}.
The anisotropic model is normally fitted once, starting from
angle = 0 and ratio = 1.2. An adaptive multi-start fallback is
used only if that fit fails or gives a smaller likelihood than the isotropic
fit. In that case, additional starting angles are tried and the fit with the
largest likelihood is retained. The same estimation rule is used for the
observed data and for every bootstrap replication.
For pairwise composite likelihood, the isotropic and anisotropic fits must use the same retained pairs. The function checks this condition before computing the likelihood-ratio statistic.
The estimates obtained from the observed fits are used as starting values in the bootstrap refits. Failed bootstrap replications are removed from the empirical null distribution and are reported in the returned object. A warning is issued when fewer than 80 percent of the replications are successful or when fewer than 20 valid bootstrap statistics are available.
An invisible list with components:
statistic |
Observed likelihood-ratio statistic. |
pvalue |
Parametric-bootstrap p-value. |
ratio_hat |
Estimated anisotropy ratio under the alternative. |
angle_hat |
Estimated anisotropy angle under the alternative. |
corrmodel |
Correlation model used in the test. |
model |
Marginal model used in the test. |
likelihood |
Likelihood type used in the fits. |
type |
Likelihood construction used in the fits. |
method |
Simulation method used under the null hypothesis. |
L |
Number of turning-bands components, or |
seed |
Seed supplied by the user, or |
fit_H0 |
Fitted isotropic |
fit_H1 |
Fitted anisotropic |
observed_fallback_used |
Logical indicating whether the adaptive multi-start fallback was used for the observed anisotropic fit. |
observed_H1_attempts |
Number of anisotropic fitting attempts for the observed data. |
B_rep |
Vector of valid bootstrap likelihood-ratio statistics. |
bootstrap_B |
Requested number of bootstrap replications. |
bootstrap_successful |
Number of valid bootstrap replications. |
bootstrap_success_rate |
Proportion of valid bootstrap replications. |
bootstrap_fallbacks |
Number of bootstrap replications in which the adaptive multi-start fallback was activated. |
bootstrap_attempts |
Number of anisotropic fitting attempts used in each bootstrap replication. |
bootstrap_failures |
Data frame containing the indices and error messages of failed bootstrap replications. |
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, GeoVariogramDir
## Not run:
## Isotropy test for a Gaussian random field simulated under H0
set.seed(123)
n <- 500
coords <- cbind(runif(n), runif(n))
param <- list(
mean = 0,
nugget = 0,
sill = 1,
scale = 0.20,
smooth = 0.5
)
z <- GeoSim(
coordx = coords,
corrmodel = "Matern",
model = "Gaussian",
param = param
)$data
start <- list(
mean = 0,
sill = 1,
scale = 0.20,
smooth = 0.5
)
fixed <- list(nugget = 0)
lower <- list(
mean = -5,
sill = 0.01,
scale = 0.01,
smooth = 0.05
)
upper <- list(
mean = 5,
sill = 5,
scale = 1,
smooth = 2.5
)
#iso_test <- GeoTestIsotropy(
# data = z,
# coordx = coords,
# start = start,
# fixed = fixed,
# optimizer = "bobyqa",
# model = "Gaussian",
# corrmodel = "Matern",
# lower = lower,
# upper = upper,
# B = 99,
# likelihood = "Full",
# type = "Standard",
# method = "cholesky",
# parallel =TRUE,
# seed = 321)
#iso_test$statistic
#iso_test$pvalue
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.