Skip to contents

spatial() marks structured spatial dependence. The first fitted path is the univariate Gaussian location random intercept spatial(1 | site, coords = coords), where coords is a matrix or data frame with one row per site or one row per observation. The univariate Gaussian location path also supports one numeric slope, spatial(1 + x | site, coords = coords), as independent intercept and slope fields with separate SDs and no intercept-slope correlation. Matching labelled bivariate Gaussian mu1/mu2 terms fit the first q=2 coordinate-spatial location covariance, matching univariate Gaussian mu and sigma intercept terms fit one spatial mean-scale correlation, and matching labelled all-four mu1/mu2/sigma1/sigma2 terms fit the first constant q=4 location-scale block. Fitted non-Gaussian spatial routes cover the univariate student mu q=1 intercept or one-slope, ordinary Poisson and NB2 mu q=1 intercepts or one-slopes, zero-inflated Poisson zi q=1 intercept, and the NB2 sigma q=1 one-slope, all at recovery grade: trust the point estimate, not the interval. Mesh inputs, multiple structured slopes, residual-scale structured slopes beyond the NB2 one-slope gate, slope correlations, and predictor-dependent spatial corpair() regression remain planned.

Usage

spatial(term, coords = NULL, mesh = NULL)

Arguments

term

Structured random-effect term, such as 1 | site.

coords

Coordinate object, such as a data frame or matrix of spatial coordinates.

mesh

Planned precomputed mesh object.

Value

A formula marker; never evaluated by users.

Examples

# Fitted for univariate Gaussian mu with coords:
bf(y ~ x + spatial(1 | site, coords = coords), sigma ~ z)
#> <drm_formula>
#> y ~ x + spatial(1 | site, coords = coords)
#> sigma ~ z
# Fitted first q=2 bivariate spatial location block:
bf(
  mu1 = y1 ~ x + spatial(1 | p | site, coords = coords),
  mu2 = y2 ~ x + spatial(1 | p | site, coords = coords),
  sigma1 = ~ 1,
  sigma2 = ~ 1,
  rho12 = ~ 1
)
#> <drm_formula>
#> mu1 = y1 ~ x + spatial(1 | p | site, coords = coords)
#> mu2 = y2 ~ x + spatial(1 | p | site, coords = coords)
#> sigma1 = ~1
#> sigma2 = ~1
#> rho12 = ~1
# Planned:
bf(y ~ x + spatial(1 | site, mesh = mesh), sigma ~ z)
#> <drm_formula>
#> y ~ x + spatial(1 | site, mesh = mesh)
#> sigma ~ z