Skip to contents

Forms an across-site time–time correlation matrix of `z_infer` (pairwise complete), averages super-diagonals by lag to get an empirical ACF, then fits a product kernel `k(h)=k_per(h; alpha, period) * k_rbf(h; theta)` by least-squares.

Usage

infer_time_kernel_params(
  data,
  period,
  nt,
  n,
  plot = FALSE,
  max_pairs = 1000,
  lower = c(0.1, 1),
  upper = c(10, 10 * 10000)
)

Arguments

data

Data frame with column `z_infer` and facetting columns `id`, `t` (times fastest within site).

period

Numeric period used in the periodic kernel.

nt

Integer, number of time points.

n

Integer, number of sites.

plot

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

max_pairs

Integer; optional downsampling of per-lag pairs for speed.

lower

A vector of length 2 with lower bounds of search

upper

A vector of length 2 with upper bounds of search

Value

A list with `periodic_scale`, `long_term_scale` and `period`.