View source: R/GeoNeighbSelect.R
| GeoNeighbSelect | R Documentation |
The procedure fits pairwise composite likelihood models over user-specified spatial
or space-time neighborhoods and selects the candidate minimizing the sum of squared
differences between the fitted and empirical semivariograms. A
GeoVariogram object must be supplied.
GeoNeighbSelect(data, coordx, coordy=NULL,coordz=NULL, coordt=NULL, coordx_dyn=NULL,
copula=NULL,corrmodel=NULL, distance="Eucl",fixed=NULL,anisopars=NULL,
est.aniso=c(FALSE,FALSE), grid=FALSE, likelihood='Marginal',lower=NULL,
neighb=c(1,2,3,4,5),p_neighb=1,maxtime=Inf, memdist=TRUE,model='Gaussian',
n=1, ncores=6,optimizer='Nelder-Mead', parallel=FALSE,
bivariate=FALSE,radius=1, start=NULL,type='Pairwise', upper=NULL,
weighted=FALSE,X=NULL,spobj=NULL,spdata=NULL,vario=NULL,progress=TRUE,
check.duplicates=FALSE)
data |
A |
coordx |
A numeric ( |
coordy |
A numeric vector giving 1-dimension of
spatial coordinates; Optional argument, the default is |
coordz |
A numeric vector giving 1-dimension of
spatial coordinates; Optional argument, the default is |
coordt |
A numeric vector assigning one dimension of temporal coordinates. Optional argument; the default is |
coordx_dyn |
A list of |
copula |
String; the type of copula. It can be "Clayton" or "Gaussian" |
corrmodel |
String; the name of a correlation model, for the
see |
distance |
String; the name of the spatial distance. The default is |
fixed |
An optional named list giving the values of the parameters that will be considered as known values. The listed parameters for a given correlation function will be not estimated. |
anisopars |
A list of two elements: "angle" and "ratio" i.e. the anisotropy angle and the anisotropy ratio, respectively. |
est.aniso |
A bivariate logical vector providing which anisotropic parameters must be estimated. |
grid |
Logical; if |
likelihood |
String; the configuration of the composite
likelihood. |
lower |
An optional named list giving the values for the lower bound of the space parameter
when the optimizer is |
neighb |
Numeric; a vector of positive integers indicating the
order of neighborhood in the weight function of composite likelihood
(see |
p_neighb |
Numeric; a value in |
maxtime |
Numeric vector of non-negative maximum temporal-distance thresholds, expressed in the same units as |
memdist |
Deprecated logical argument retained for backward compatibility. The selected pair structure is always precomputed and reused. Supplying |
model |
String; the type of random fields and therefore the densities associated to the likelihood
objects. |
n |
Numeric; number of trials in a binomial random fields; number of successes in a negative binomial random fields |
ncores |
Positive integer or |
optimizer |
String; the optimization algorithm
(see |
parallel |
Logical; default |
bivariate |
Logical; if |
radius |
Numeric; the radius of the sphere in the case of lon-lat coordinates. Default value is 1. |
start |
An optional named list with the initial values of the
parameters that are used by the numerical routines in maximization
procedure. |
type |
String; the type of the likelihood objects. If |
upper |
An optional named list giving the values for the upper bound
of the space parameter when the optimizer is or |
weighted |
Logical; if |
X |
Numeric; Matrix of spatio(temporal)covariates in the linear mean specification. |
spobj |
An object of class sp or spacetime |
spdata |
Character:The name of data in the sp or spacetime object |
vario |
An object of class |
progress |
Logic; If TRUE then a progress bar is shown. |
check.duplicates |
Logical. If |
For a spatial univariate model, the criterion compares the fitted and empirical
spatial semivariograms at the empirical bin centers. For a bivariate model, the two
marginal semivariograms and the cross-semivariogram are compared in the order
(11,12,22). For a space-time model, the spatial and temporal margins and
the complete rectangular space-time semivariogram surface are compared jointly.
Only finite empirical cells contribute to the criterion; a candidate is rejected
when its corresponding fitted values are non-finite or dimensionally incompatible.
The absolute minimum defines the best candidate. The function also reports a more parsimonious neighborhood using the existing plateau rule: the smallest neighborhood whose criterion is within 15 percent of the minimum. If every candidate fit fails or produces a non-finite criterion, the function stops with an error instead of selecting an arbitrary candidate.
A list with components:
best_neighb: neighborhood associated with the smallest criterion;
best_maxtime: selected temporal neighborhood for a space-time model,
otherwise NULL;
best_estimates: named parameter estimates for the best candidate;
res: variogram sum-of-squares criterion for every candidate;
estimates: matrix of parameter estimates, with columns aligned to
the names in start;
sugg_neighb: parsimonious neighborhood selected by the 15 percent
plateau rule;
sugg_time: corresponding temporal neighborhood for a space-time
model, otherwise NULL.
Moreno Bevilacqua, moreno.bevilacqua89@gmail.com,https://sites.google.com/view/moreno-bevilacqua/home, Víctor Morales Oñate, victor.morales@uv.cl, https://sites.google.com/site/moralesonatevictor/, Christian Caamaño-Carrillo, chcaaman@ubiobio.cl,https://www.researchgate.net/profile/Christian-Caamano
library(GeoModels)
######### spatial case
set.seed(32)
N=500 # number of location sites
x <- runif(N, 0, 1)
y <- runif(N, 0, 1)
coords <- cbind(x,y)
mean <- 0.2
# Set the covariance model's parameters:
corrmodel <- "Matern"
sill <- 1;nugget <- 0
scale <- 0.2/3;smooth=0.5
model="Gaussian"
param<-list(mean=mean,sill=sill,nugget=nugget,scale=scale,smooth=smooth)
# Simulation
data <- GeoSim(coordx=coords,corrmodel=corrmodel, param=param,model=model)$data
I=Inf
fixed<-list(nugget=nugget)
start<-list(mean=mean,scale=scale,smooth=smooth,sill=sill)
lower<-list(mean=-I,scale=0,sill=0,smooth=0)
upper<-list(mean=I,scale=I,sill=I,smooth=I)
vario = GeoVariogram(coordx=coords,data=data,maxdist=0.3,numbins=15)
neighb=c(1,2,3,4) ## trying different neighbs
selK <- GeoNeighbSelect(vario=vario,data=data,coordx=coords,corrmodel=corrmodel,
model=model,neighb=neighb,
likelihood="Conditional",type="Pairwise",parallel=FALSE,
optimizer="nlminb",lower=lower,upper=upper,
start=start,fixed=fixed)
print(selK$best_neighb) ## selected neighbor
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.