Specify a Gaussian-process spatial random effect, approximated with a nearest-neighbour GP (NNGP) for scalability. Captures smooth spatial variation from point-referenced coordinates.
Usage
spatial_gp(
coords,
approx = c("nngp", "hsgp"),
cov = c("exponential", "matern"),
nu = 1.5,
nn = 15,
m = 6,
c = 1.5,
sigma_prior_U = 1,
sigma_prior_alpha = 0.01,
shared = NULL,
scale_coords = TRUE,
parameterization = c("noncentered", "centered", "collapsed")
)
# S3 method for class 'tulpa_gp'
print(x, ...)
# S3 method for class 'tulpa_hsgp'
print(x, ...)Arguments
- coords
A formula (
~ lon + lat) or character vector naming the coordinate variables in the data. Withapprox = "nngp"the coordinate DIMENSION is however many are named: two for a map, one for a transect or a depth profile, three for a depth-resolved domain. The neighbour graph and the neighbour covariance both read every column.approx = "hsgp"takes exactly two, and so does any sampler mode, because both store coordinates at a fixed 2-D stride.- approx
GP approximation:
"nngp"(default, a nearest-neighbour GP with thecov/nu/nnarguments) or"hsgp"(a Hilbert-space basis GP withmfunctions per dimension and boundary factorc).- cov
Covariance function (NNGP only). One of
"exponential"or"matern".- nu
Matern smoothness parameter, one of
1.5or2.5. Used only whencov = "matern"(nu = 0.5iscov = "exponential").- nn
Number of nearest neighbours used in the NNGP approximation.
- m
Number of HSGP basis functions per dimension (
approx = "hsgp").- c
HSGP boundary factor,
>= 1(approx = "hsgp").- sigma_prior_U, sigma_prior_alpha
Penalized-complexity prior on the field's marginal standard deviation (
approx = "hsgp"), calibrated so thatP(sigma > sigma_prior_U) = sigma_prior_alpha. Defaults toP(sigma > 1) = 0.01.sigma_prior_Umust be positive andsigma_prior_alphamust lie in(0, 1).Whether the spatial effect is shared across processes in a multi-process model.
NULL(default) shares the effect;FALSEfits process-specific effects and emits a warning.- scale_coords
Logical. Standardize coordinates before fitting (default
TRUE): each column is centred and all are divided by one common factor, so distances keep their proportions and an isotropic kernel stays isotropic.spatial_range()reports the range in the original coordinate units either way.- parameterization
Latent parameterization for the exact-NUTS field. One of
"noncentered"(default; samplesz ~ N(0, I)and reconstructs the field asw = f(z, sigma2, phi), avoiding the field/hyperparameter funnel),"centered"(places the NNGP density on the field directly), or"collapsed"(deprecated).- x
A
tulpa_gportulpa_hsgpspecification.- ...
Ignored.
See also
spatial_car(), spatial_bym2() for areal spatial effects.