View source: R/GeoTestIsotropy.R
| GeoTestIsotropy | R Documentation |
Performs two parametric-bootstrap tests of spatial isotropy by comparing an isotropic model under the null hypothesis with a geometrically anisotropic model under the alternative. The first test (MWCLT) is based on the estimated anisotropy ratio. The second test (WCLRT) is based on a likelihood-ratio or composite-likelihood-ratio statistic. Their null distributions are 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,
n = 1,
angle_starts = c(pi/4, 3*pi/4),
batch_size = NULL,
max_attempts = NULL,
parallel = FALSE,
ncores = 6,
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 valid parametric-bootstrap replications used to calibrate each test. Failed fitting attempts are replaced by newly simulated samples. |
likelihood |
Likelihood type passed to |
type |
Likelihood type passed to |
copula |
Optional copula specification. With a supported purely spatial
correlation model, both |
neighb |
Number of nearest neighbours used when
|
method |
Simulation method under the null hypothesis. Use
|
L |
Number of spectral components used when |
n |
Common number of trials/successes used by models that require an
integer |
angle_starts |
Finite numeric vector of starting angles used for the
anisotropic fit. All supplied angles are tried (modulo |
batch_size |
Number of bootstrap datasets simulated and processed at one
time. If |
max_attempts |
Maximum number of simulated bootstrap datasets allowed in
order to collect exactly |
parallel |
Logical; if |
ncores |
Positive integer or |
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 and the ratio is on the boundary of its
parameter space. Consequently, a standard chi-squared reference distribution
is not assumed; both tests are calibrated by parametric bootstrap.
The MWCLT statistic is the unconstrained anisotropy-ratio estimate
\widehat\tau. If \widehat\tau_b^* denotes the corresponding
estimate in bootstrap replication b, the upper-tail bootstrap p-value is
\widehat p_\tau = \frac{1 + \sum_{b=1}^B I(\widehat\tau_b^* \geq \widehat\tau)}{B+1}.
The WCLRT 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. Its bootstrap p-value
is
\widehat p_T = \frac{1 + \sum_{b=1}^B I(T_b \geq T_{\mathrm{obs}})}{B+1}.
The returned components statistic and pvalue remain aliases for
this WCLRT statistic and p-value for backward compatibility.
For every observed or bootstrap anisotropic fit, all angles in
angle_starts are used as starting values and the valid fit with the
largest objective value is retained. During bootstrap refitting, the fitted
observed anisotropy angle is also included as a starting angle. If the best
numerical anisotropic fit has an objective value below the isotropic fit by
more than numerical tolerance, the boundary solution is selected, giving
ratio 1 and WCLRT statistic 0.
For pairwise composite likelihood, the isotropic and anisotropic fits must use the same retained pairs. The function checks this condition before computing the WCLRT statistic.
Bootstrap datasets are generated from the fitted isotropic model in batches.
Failed bootstrap fits do not enter the empirical null distribution: new
samples are generated until exactly B valid replications have been
collected, or until max_attempts is reached. This makes the denominator
of both bootstrap p-values exactly B+1.
The argument n is propagated consistently to GeoFit,
GeoSim, GeoSimapprox, and GeoSimCopula. Direct latent
Gaussian simulation of some non-Gaussian models imposes additional structural
constraints. In particular, direct "Gamma" simulation requires the
fitted shape to be a positive integer because it is the number of
squared latent Gaussian fields. For the direct Gamma model used in the latent
construction, it is therefore recommended to keep shape fixed at a
positive integer during the isotropy test. This integer restriction does not
apply merely because the marginal distribution is Gamma when a supported
copula construction is used.
An invisible list containing, among others:
statistic, pvalue |
Backward-compatible aliases for the observed WCLRT statistic and its bootstrap p-value. |
statistic_lrt, pvalue_lrt |
Observed WCLRT statistic and p-value. |
statistic_ratio, pvalue_ratio |
Observed MWCLT anisotropy-ratio statistic and p-value. |
pvalues |
Named vector containing the MWCLT and WCLRT p-values. |
ratio_hat, angle_hat |
Estimated anisotropy ratio and angle. The angle is
|
parallel, ncores |
Whether parallel bootstrap refitting was used and the number of workers selected by the function. |
fit_H0, fit_H1 |
Fitted isotropic and best anisotropic |
B_rep, B_rep_lrt |
The |
B_rep_ratio |
The |
B_rep_angle |
Bootstrap angle estimates; boundary solutions are
|
bootstrap_B |
Requested and obtained number of valid bootstrap replications. |
bootstrap_total_attempts |
Total number of simulated datasets needed to
obtain |
bootstrap_failed_attempts |
Number of failed attempts that were replaced. |
bootstrap_failures |
Data frame describing failed attempts. |
bootstrap_boundary_solutions |
Number of valid bootstrap replications for which the boundary solution was selected. |
observed_multistart_angles |
Starting angles used for the observed H1 fit. |
batch_size, max_attempts |
Bootstrap batching and retry settings used by the function. |
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 tests for a Gaussian random field simulated under H0
set.seed(123)
nsite <- 500
coords <- cbind(runif(nsite), runif(nsite))
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,
model = "Gaussian",
corrmodel = "Matern",
lower = lower,
upper = upper,
B = 99,
likelihood = "Full",
type = "Standard",
method = "cholesky",
seed = 321
)
iso_test$pvalue_ratio # MWCLT
iso_test$pvalue_lrt # WCLRT
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.