| GeoFit2 | R Documentation |
A univariate starting-value wrapper around GeoFit. The function optionally
performs a preliminary fit under spatial independence to estimate available
marginal parameters, uses those estimates to update the starting values, and
then calls GeoFit for the requested final fit. If the preliminary
independence fit is unavailable or fails, the original starting values are
retained. Bivariate correlation models are not supported.
GeoFit2(data, coordx = NULL, 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, maxdist = Inf,
neighb = NULL, p_neighb = 1, maxtime = Inf, memdist = TRUE,
method = "cholesky", model = "Gaussian", n = 1,
onlyvar = FALSE, optimizer = "Nelder-Mead", radius = 1,
score = FALSE, sensitivity = FALSE, sparse = FALSE,
start = NULL, thin_method = "bernoulli", type = "Pairwise",
upper = NULL, varest = FALSE, weighted = FALSE, X = NULL,
spobj = NULL, spdata = NULL, independence_start = TRUE,
independence_optimizer = "Nelder-Mead",
warn_independence_failure = TRUE, check.duplicates = FALSE)
data |
A |
coordx |
A numeric ( |
coordy |
A numeric vector giving 1-dimension of spatial coordinates; optional argument, default is |
coordz |
A numeric vector giving 1-dimension of spatial coordinates; optional argument, default is |
coordt |
A numeric vector assigning one dimension of the observation-time coordinates. Optional argument, default is |
coordx_dyn |
A list of |
copula |
String; the type of copula. It can be |
corrmodel |
String; the name of a correlation model; see |
distance |
String; the name of the spatial distance. 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 not be estimated. |
anisopars |
A list of two elements: |
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 lower bounds for parameters when the optimizer is |
maxdist |
Numeric; an optional positive value indicating the maximum spatial distance considered in the composite likelihood computation. See Details for more information. |
neighb |
Numeric; an optional positive integer indicating the order of neighborhood in the composite likelihood computation. See Details for more information. |
p_neighb |
Numeric scalar in |
maxtime |
Numeric; an optional non-negative maximum temporal-distance threshold, expressed in the same units as |
memdist |
Deprecated logical argument retained for backward compatibility. The selected pair structure is always precomputed and reused during composite-likelihood optimization. Supplying |
method |
String; the type of matrix decomposition used in the likelihood computation. Default is |
model |
String; the type of RF and therefore the densities associated to the likelihood objects.
|
n |
Positive integer scalar, or one positive integer per observation, for models using a Binomial/Negative-Binomial trial or success count. |
onlyvar |
Logical; if |
optimizer |
String; the optimization algorithm (see |
radius |
Numeric; the radius of the sphere in the case of lon-lat coordinates. Default value is |
score |
Logical; should score function be computed? Default is |
sensitivity |
Logical; if |
sparse |
Logical; if |
start |
An optional named list with initial values for parameters used by the numerical routines in the maximization procedure.
Default is |
thin_method |
String; thinning scheme used when |
type |
String; the type of the likelihood objects. If |
upper |
An optional named list giving upper bounds for parameters when the optimizer is |
varest |
Logical; if |
weighted |
Logical; if |
X |
Numeric; matrix of spatio(temporal) covariates in the linear mean specification. |
spobj |
An object of class |
spdata |
Character; the name of data in the |
independence_start |
Logical; if |
independence_optimizer |
String; optimizer used only for the preliminary
independence fit. Default is |
warn_independence_failure |
Logical; if |
check.duplicates |
Logical. If |
GeoFit2 does not implement a second fitting engine. It is a wrapper
around the canonical GeoFit function.
When independence_start=TRUE, the function first constructs a
preliminary call to GeoFit with likelihood="Marginal" and
type="Independence". The preliminary fit estimates the marginal
parameters available for the selected model. When start is supplied,
matching marginal entries and omitted mean coefficients are updated as before.
When start=NULL, all eligible marginal estimates from the independence
fit are used, while dependence parameters use the conservative automatic
initial values prepared by GeoFit. Parameters supplied in fixed
always take precedence.
The final model is then fitted by calling GeoFit with the original
requested likelihood, likelihood-object type, optimizer, bounds, pair-selection
settings, and the updated starting values. Consequently, the objective function,
parameter constraints, and returned standard GeoFit components are the
same as in a direct call to GeoFit; only the starting values may differ.
For Gaussian models, sill is the total marginal variance and
nugget attenuates off-diagonal correlation. Therefore an independence
estimate may initialize sill, while a user-supplied nugget is
preserved unchanged and is never added to or subtracted from sill.
Bivariate correlation models are not supported by GeoFit2; use
GeoFit directly. The preliminary initialization is skipped when
type="Independence". If an independence likelihood is not
implemented for the selected model, or if the preliminary optimization fails,
the final fit still proceeds using the supplied starting values or, when
start=NULL, the internal starting values prepared by GeoFit. This
behavior can be controlled with warn_independence_failure.
Stochastic thinning of nearest-neighbor pairs in the final fit can be enabled
through p_neighb < 1; thin_method specifies the thinning
scheme.
Returns an object of class GeoFit.
An object of class GeoFit is a list containing at most the following components:
bivariate |
Logical: |
clic |
The composite information criterion after a |
coordx |
A |
coordy |
A |
coordt |
A |
coordx_dyn |
A list of dynamical (in time) spatial coordinates. |
conf.int |
Confidence intervals for standard maximum likelihood estimation. |
convergence |
A string that denotes if convergence is reached. |
copula |
The type of copula. |
corrmodel |
The correlation model. |
data |
The vector or matrix or array (or list) of data. |
distance |
The type of spatial distance. |
fixed |
A list of fixed parameters. |
iterations |
The number of iterations used by the numerical routine. |
likelihood |
The configuration of the composite likelihood. |
logCompLik |
The value of the log composite-likelihood at the maximum. |
maxdist |
The maximum spatial distance used in the weighted composite likelihood (or |
maxtime |
The maximum temporal-distance threshold used in the composite likelihood, expressed in the same units as |
message |
Extra message passed from the numerical routines. |
model |
The density associated to the likelihood objects. |
missp |
|
n |
The number of trials in a binomial RF; the number of successes in a negative binomial random field. |
neighb |
The order of spatial neighborhood in the composite likelihood computation. |
ns |
The number of (different) location sites in the bivariate case. |
numcoord |
The number of spatial coordinates. |
numtime |
The number of temporal realisations of the random field. |
param |
A list of parameter estimates. |
radius |
The radius of the sphere in the case of great-circle distance. |
stderr |
Standard errors for standard maximum likelihood estimation. |
sensmat |
The sensitivity matrix. |
varcov |
The variance-covariance matrix of the estimates. |
type |
The type of the likelihood objects. |
X |
The matrix of covariates. |
start_original |
The named list of starting values supplied by the user. |
start_used |
The named list of starting values passed to the final
|
independence_fit |
The preliminary independence |
independence_start_message |
A character string describing why the
preliminary initialization was unavailable or failed, or |
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
The methodological references for maximum weighted composite-likelihood
fitting of Gaussian and non-Gaussian random fields are reported in
GeoFit.
GeoCovmatrix for covariance matrix construction,
GeoSim for simulation,
GeoKrig for prediction,
GeoVariogram and GeoWLS for variogram-based tools,
GeoVarest for bootstrap variance estimation.
library(GeoModels)
###############################################################
############ Examples of spatial Gaussian random fields ################
###############################################################
################################################################
###
### Example 1 : Maximum pairwise conditional likelihood fitting
### of a Gaussian RF with Matern correlation
###
###############################################################
model="Gaussian"
# Define the spatial-coordinates of the points:
set.seed(3)
N=400 # number of location sites
x <- runif(N, 0, 1)
set.seed(6)
y <- runif(N, 0, 1)
coords <- cbind(x,y)
# Define spatial matrix covariates
X=cbind(rep(1,N),runif(N))
# Set the covariance model's parameters:
corrmodel <- "Matern"
mean <- 0.2
mean1 <- -0.5
sill <- 1
nugget <- 0
scale <- 0.2/3
smooth=0.5
param<-list(mean=mean,mean1=mean1,sill=sill,nugget=nugget,scale=scale,smooth=smooth)
# Simulation of the spatial Gaussian RF:
data <- GeoSim(coordx=coords,model=model,corrmodel=corrmodel, param=param,X=X)$data
fixed<-list(nugget=nugget,smooth=smooth)
start<-list(mean=mean,mean1=mean1,scale=scale,sill=sill)
################################################################
###
### Maximum pairwise likelihood fitting of
### Gaussian random fields with exponential correlation.
###
###############################################################
fit1 <- GeoFit2(data=data,coordx=coords,corrmodel=corrmodel,
neighb=3,likelihood="Conditional",
type="Pairwise", start=start,fixed=fixed,X=X)
print(fit1)
###############################################################
############ Examples of spatial non-Gaussian random fields #############
###############################################################
################################################################
###
### Example 2. Maximum pairwise likelihood fitting of
### a LogGaussian RF with Generalized Wendland correlation
###
###############################################################
set.seed(524)
# Define the spatial-coordinates of the points:
N=500
x <- runif(N, 0, 1)
y <- runif(N, 0, 1)
coords <- cbind(x,y)
X=cbind(rep(1,N),runif(N))
mean=1; mean1=2 # regression parameters
nugget=0
sill=0.5
scale=0.2
smooth=0
model="LogGaussian"
corrmodel="GenWend"
param=list(mean=mean,mean1=mean1,sill=sill,scale=scale,
nugget=nugget,power2=4,smooth=smooth)
# Simulation of a non stationary LogGaussian RF:
data <- GeoSim(coordx=coords, corrmodel=corrmodel,model=model,X=X,
param=param)$data
fixed<-list(nugget=nugget,power2=4,smooth=smooth)
start<-list(mean=mean,mean1=mean1,scale=scale,sill=sill)
I=Inf
lower<-list(mean=-I,mean1=-I,scale=0,sill=0)
upper<-list(mean= I,mean1= I,scale=I,sill=I)
# Maximum pairwise composite-likelihood fitting of the RF:
fit <- GeoFit2(data=data,coordx=coords,corrmodel=corrmodel, model=model,
neighb=3,likelihood="Conditional",type="Pairwise",X=X,
optimizer="nlminb",lower=lower,upper=upper,
start=start,fixed=fixed)
print(unlist(fit$param))
################################################################
###
### Example 3. Maximum pairwise likelihood fitting of
### SinhAsinh random fields with Wendland0 correlation
###
###############################################################
set.seed(261)
model="SinhAsinh"
# Define the spatial-coordinates of the points:
x <- runif(500, 0, 1)
y <- runif(500, 0, 1)
coords <- cbind(x,y)
corrmodel="Wend0"
mean=0;nugget=0
sill=1
skew=-0.5
tail=1.5
power2=4
c_supp=0.2
# model parameters
param=list(power2=power2,skew=skew,tail=tail,
mean=mean,sill=sill,scale=c_supp,nugget=nugget)
data <- GeoSim(coordx=coords, corrmodel=corrmodel,model=model, param=param)$data
plot(density(data))
fixed=list(power2=power2,nugget=nugget)
start=list(scale=c_supp,skew=skew,tail=tail,mean=mean,sill=sill)
# Maximum pairwise likelihood:
fit1 <- GeoFit2(data=data,coordx=coords,corrmodel=corrmodel, model=model,
neighb=3,likelihood="Marginal",type="Pairwise",
start=start,fixed=fixed)
print(unlist(fit1$param))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.