Create or update the LatticeKrig model object (LKinfo) for spatial fitting.

Description

This function combines some input arguments with defaults for other to create a list describing the LatticeKrig spatial model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
LKrigSetup(x = NULL, nlevel = NULL, alpha = NA, nu = NULL, a.wght
                 = NA, normalize = TRUE, lambda = NA, sigma = NA, rho =
                 NA, rho.object = NULL, latticeInfo = NULL, basisInfo =
                 NULL, LKGeometry = "LKRectangle", distance.type =
                 "Euclidean", BasisFunction = "WendlandFunction",
                 overlap = 2.5, V = NULL, BasisType = "Radial",
                 fixedFunction = "LKrigDefaultFixedFunction",
                 fixedFunctionArgs = list(m = 2), max.points = NULL,
                 mean.neighbor = 50, choleskyMemory = NULL, verbose =
                 FALSE, noCheck = FALSE, setupArgs = NULL, ...)                 
LatticeKrigEasyDefaults(argList, nlevel, x)

LKinfoUpdate(LKinfo, ... )

Arguments

argList

Argument supplied to the top level LatticeKrig function.

alpha

A vector of length nlevel with the relative variances for the different multiresolution levels.

a.wght

A vector of length nlevel that are the weights for the central point in the Markov random field specification. To be precise at level k the center point has weight a.wght[k] with the 4 nearest neighbors given weight -1. The a.wght must be greater than 4 for the fields to be stationary.

basisInfo

A list with extra components the object used to describe the multiresolution basis. Usually this will not be needed for standard models.

BasisType

A character string indicating the type of basis function. Currently this is either "Radial" or "Tensor".

choleskyMemory

A list that will be used in the spam call to do the Cholesky decomposition. See the memory argument in chol.spam.

distance.type

A text string indicate type distance to use between spatial locations when evaluating the basis functions. Default is "Euclidean". Other choices when locations are in degrees longitude and latitude are "Chordal" and "GreatCircle". The default radius is in miles (3963.34) but can be reset using the "Radius" attribute to the text string.

e.g. dtype<- "Chordal"; attr( dtype, which="Radius") <- 6371

will set radius to kilometers.

fixedFunction

A text string that is the name of the function used to find the fixed part of the spatial model based on the locations. The default is a linear (m=2) polynomial in the spatial coordinates.

fixedFunctionArgs

A list containing arguments to supply when evaluating the fixed function.

lambda

The "noise to signal ratio" or also known as the smoothing parameter it is the parameter lambda = sigma^2/rho. If specified then sigma and rho typically are estimated in LKrig by maximum likelihood. If lambda is not specified then it is set as lambda = sigma^2/ rho. Note that to evaluate the spatial process model, e.g. using the function LKrig.cov, a value of lambda is not needed and this argument can default to NA.

latticeInfo

Part or all of the object used to describe the Markov random field lattice. In the standard cases this list is created in the setup function and need not be specified. See LKrigSetupLattice for details. Note that the contents of this list is concatenated to any additional components supplied by LKrigSetupLattice.

LKGeometry

A text string that gives the names of the model geometry. The default is "LKrectangle" assuming the the spatial domain is a rectangle. Other common choices are "LKInterval" (1 d problem ) and "LKBox" (3 d problem)

LKinfo

A list that has class "LKinfo".

mean.neighbor

The average number of nonzero points when each basis function is evaluated at a set of points points in the spatial domain.

max.points

This is a parameter for the nearest neighbor distance function that sets the maximum array size for the nonzero distances among points. e.g. with 100 points each with 20 nonzero neighbors max.points needs to be 2000 = 100*20. Specifically if the total number of nonzero values when each basis function is evaluated at all the spatial locations. The easier way to specify space is by using the mean.neighbor argument.

nlevel

Number of levels in multiresolution. Note that each subsequent level increases the number of basis functions within the spatial domain size by a factor of roughly 4.

noCheck

If FALSE do not make any checks on the consistency of the different parts of the final LKinfo object. e.q. values of a.wght within the range of a stationary Markov random field.

normalize

If TRUE the basis functions will be normalized to give a marginal variance of one for each level of multiresolution. (Normalizing by levels makes it easier to interpret the alpha weights.)

nu

A smoothness parameter that controls relative sizes of alpha. Currently this parameter only makes sense for the 2D rectangular domain (LKRectangle)

overlap

Controls the overlap among the radial basis functions and should be in units of the lattice spacing. For the rectangular case the default of 2.5 means that the support of the Wenland basis function will overlap 2.5 lattice units in each direction. See LKrig.basis for how overlap enters scaling in the formula.

rho

A scalar, the sill or marginal variance of the process.

BasisFunction

Text string giving the 1-d form for basis function.

rho.object

A prediction object to specify part of the marginal variance for the process. Specifically the form is VAR(g(x1))= rho*h(x1) Calling predict(rho.object,x1) should return a vector with the values of h at the (arbitrary) spatial locations in x1. If omitted assumed to be the constant one – the usual case.

setupArgs

A list containing additional components that will be 1) included in the LKinfo object in the component setupArgs and 2) passed to LKrigSetupLattice to use for any specific features of constructing the lattice.

sigma

The measurement error standard deviation. Also called the nugget variance in geostatistics.

V

See entry in LKrig.

verbose

If TRUE print out intermediate information.

x

Spatial locations that define the spatial domain for prediction. This is only used to determine ranges of the grid for the basis functions so, for example, for a rectangular domain only two points are required that bound the rest of the data locations. E.g. x= rbind( c( 0,0), c(1,1)) will set the domain to be the unit square.

...

Specific arguments that will be included in setupArgs list and also passed to LKrigSetupLattice.

Details

Many of the functions within LKrigSetup are overloaded to adapt to the LKGeometry class. This makes it easy to add new geometries or other models to the LatticeKrig framework. The required components of this object (see below) outline how the latticeKrig model is structured and what should be common features independent of the geometry. The key components are latticeInfo that contains the information used to generate the spatial autoregressive matrix on the lattice (see LKrigSAR) and the lattice centers (see LKrigCenters). The component basisInfo used to generate the radial basis function (see LKrig.basis)

The function LKrigEasyDefaults is used in the top level function LattticeKrig to make the logic of different default choices more readable and reduces the clutter in this function. Its main purpose is to find a reasonable choice for NC when this is not specified.

The function LKinfoUpdate is more of a utility used for clarity that allows one to update the LKinfo object with particular components without having to recreate the entire object. This function is used in the MLE search when just values of alpha or a.wght are being varied.

Value

An object with class "LKinfo" and also the additional class given by LKGeometry. The required components are:

nlevel

Number of levels

alpha

alpha parameters as a list that has nlevel components and possibly some attributes.

a.wght

a.wght parameters as a list that has nlevel components and possibly some attributes.

nu

nu parameter

normalize

A logical indicating whether to normalize.

lambda

Value of lambda.

sigma

Value of sigma.

rho

Value for rho.

rho.object

Value for rho.object.

latticeInfo

A list with specific multiresolution lattice information

setupArgs

All arguments passed in the call and any in in ...

basisInfo

A list with basis information.

call

The actual call used to create this object.

Author(s)

Doug Nychka

Examples

1
2
3
4
  data(ozone2)
  x<-ozone2$lon.lat
  LKinfo<- LKrigSetup( x, NC=10, nlevel=2, alpha=c(1,.5), a.wght=c(5,5))
  print( LKinfo)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.