https://github.com/cran/convoSPAT
Tip revision: 2073c51e8630a7edc1e9682aa1e77927f1d5ed50 authored by Mark D. Risser on 15 January 2021, 23:50:04 UTC
version 1.2.7
version 1.2.7
Tip revision: 2073c51
Aniso_fit.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/convoSPAT_fitpred.R
\name{Aniso_fit}
\alias{Aniso_fit}
\title{Fit the stationary spatial model}
\usage{
Aniso_fit(
sp.SPDF = NULL,
coords = NULL,
data = NULL,
cov.model = "exponential",
mean.model = data ~ 1,
fixed.nugg2.var = NULL,
method = "reml",
fix.tausq = FALSE,
tausq = 0,
fix.kappa = FALSE,
kappa = 0.5,
local.pars.LB = NULL,
local.pars.UB = NULL,
local.ini.pars = NULL
)
}
\arguments{
\item{sp.SPDF}{A "\code{SpatialPointsDataFrame}" object, which contains the
spatial coordinates and additional attribute variables corresponding to the
spatoal coordinates}
\item{coords}{An N x 2 matrix where each row has the two-dimensional
coordinates of the N data locations.}
\item{data}{A vector or matrix with N rows, containing the data values.
Inputting a vector corresponds to a single replicate of data, while
inputting a matrix corresponds to replicates. In the case of replicates,
the model assumes the replicates are independent and identically
distributed.}
\item{cov.model}{A string specifying the model for the correlation
function; defaults to \code{"exponential"}.
Options available in this package are: "\code{exponential}",
\code{"matern"}, or \code{"gaussian"}.}
\item{mean.model}{An object of class \code{\link[stats]{formula}},
specifying the mean model to be used. Defaults to an intercept only.}
\item{fixed.nugg2.var}{Optional; describes the variance/covariance for
a fixed (second) nugget term (represents a known error term). Either
a vector of length N containing a station-specific variances (implying
independent error) or an NxN covariance matrix (implying dependent error).
Defaults to zero.}
\item{method}{Indicates the estimation method, either maximum likelihood
(\code{"ml"}) or restricted maximum likelihood (\code{"reml"}).}
\item{fix.tausq}{Logical; indicates whether the default nugget term
(tau^2) should be fixed (\code{TRUE}) or estimated (\code{FALSE}). Defaults to
\code{FALSE}.}
\item{tausq}{Scalar; fixed value for the nugget variance (when
\code{fix.tausq = TRUE}).}
\item{fix.kappa}{Logical; indicates if the kappa parameter should be
fixed (\code{TRUE}) or estimated (\code{FALSE}). Defaults to \code{FALSE}
(only valid for \code{cov.model = "matern"} and \code{cov.model = "cauchy"}).}
\item{kappa}{Scalar; value of the kappa parameter. Only used if
\code{fix.kappa = TRUE}.}
\item{local.pars.LB, local.pars.UB}{Optional vectors of lower and upper
bounds, respectively, used by the \code{"L-BFGS-B"} method option in the
\code{\link[stats]{optim}} function for the local parameter estimation.
Each vector must be of length five,
containing values for lam1, lam2, tausq, sigmasq, and nu. Default for
\code{local.pars.LB} is \code{rep(1e-05,5)}; default for
\code{local.pars.UB} is \code{c(max.distance/2, max.distance/2, 4*resid.var, 4*resid.var, 100)},
where \code{max.distance} is the maximum interpoint distance of the
observed data and \code{resid.var} is the residual variance from using
\code{\link[stats]{lm}} with \code{mean.model}.}
\item{local.ini.pars}{Optional vector of initial values used by the
\code{"L-BFGS-B"} method option in the \code{\link[stats]{optim}}
function for the local parameter estimation. The vector must be of length
five, containing values for lam1, lam2, tausq, sigmasq, and nu. Defaults
to \code{c(max.distance/10, max.distance/10, 0.1*resid.var, 0.9*resid.var, 1)},
where \code{max.distance} is the maximum interpoint distance of the
observed data and \code{resid.var} is the residual variance from using
\code{\link[stats]{lm}} with \code{mean.model}.}
}
\value{
A list with the following components:
\item{MLEs.save}{Table of local maximum likelihood estimates for each
mixture component location.}
\item{data}{Observed data values.}
\item{beta.GLS}{Vector of generalized least squares estimates of beta,
the mean coefficients.}
\item{beta.cov}{Covariance matrix of the generalized least squares
estimate of beta.}
\item{Mean.coefs}{"Regression table" for the mean coefficient estimates,
listing the estimate, standard error, and t-value.}
\item{Cov.mat}{Estimated covariance matrix (\code{N.obs} x \code{N.obs})
using all relevant parameter estimates.}
\item{Cov.mat.chol}{Cholesky of \code{Cov.mat} (i.e., \code{chol(Cov.mat)}),
the estimated covariance matrix (\code{N.obs} x \code{N.obs}).}
\item{aniso.pars}{Vector of MLEs for the anisotropy parameters lam1,
lam2, eta.}
\item{aniso.mat}{2 x 2 anisotropy matrix, calculated from
\code{aniso.pars}.}
\item{tausq.est}{Scalar maximum likelihood estimate of tausq (nugget
variance).}
\item{sigmasq.est}{Scalar maximum likelihood estimate of sigmasq
(process variance).}
\item{kappa.MLE}{Scalar maximum likelihood estimate for kappa (when
applicable).}
\item{fixed.nugg2.var}{N x N matrix with the fixed
variance/covariance for the second (measurement error) nugget term (defaults
to zero).}
\item{cov.model}{String; the correlation model used for estimation.}
\item{coords}{N x 2 matrix of observation locations.}
\item{global.loglik}{Scalar value of the maximized likelihood from the
global optimization (if available).}
\item{Xmat}{Design matrix, obtained from using \code{\link[stats]{lm}}
with \code{mean.model}.}
\item{fix.kappa}{Logical, indicating if kappa was fixed (\code{TRUE}) or
estimated (\code{FALSE}).}
\item{kappa}{Scalar; fixed value of kappa.}
}
\description{
\code{Aniso_fit} estimates the parameters of the stationary spatial model.
Required inputs are the observed data and locations.
Optional inputs include the covariance model (exponential is the default).
}
\examples{
\dontrun{
# Using iid standard Gaussian data
aniso.fit <- Aniso_fit( coords = cbind(runif(100), runif(100)),
data = rnorm(100) )
}
}