Skip to contents

Computes cross-site correlations (pairwise complete) of `z_infer` across time, pairs them with inter-site distances, and fits an RBF (`exp(-d^2/(2θ^2))`) by least squares to obtain the spatial length scale.

Usage

infer_space_kernel_params(
  data,
  nt,
  n,
  plot = FALSE,
  max_pairs = 1000,
  lower = 0,
  upper = 100
)

Arguments

data

Data frame with columns `z_infer`, `lon`, `lat`.

nt

Integer, number of time points (used to reshape).

n

Integer, number of sites (used to reshape).

plot

Logical; if `TRUE`, show empirical vs fitted correlation–distance curve.

max_pairs

Integer; optional downsampling of site pairs for speed.

lower

Lower bound of search

upper

Upper bound of search

Value

A list with `length_scale`.