Fit a spatiotemporal GP to log–counts (matrix-free PCG)
fit.Rd
Fits a separable spatiotemporal Gaussian process to the working log–count scale and returns posterior means/uncertainties plus simple predictive summaries. The solve uses a **matrix-free** preconditioned conjugate gradient (PCG) on the observed system with a Kronecker covariance \(K = K_{\mathrm{space}} \otimes K_{\mathrm{time}}\).
Arguments
- obs_data
Tibble/data.frame with one row per site–time. Must contain at least columns `id`, `t`, `y_obs` (counts, may be `NA`), `mu_infer` (site mean on log scale), and `f_infer` (working response, e.g. `log(y_obs+1) - mu_infer`).
- coordinates
Tibble/data.frame with site metadata used by the spatial kernel (e.g. `id`, `lat`, `lon`).
- hyperparameters
Numeric length-3 vector: `c(space_length_scale, time_periodic_scale, time_long_term_scale)`.
- n
Integer, number of sites.
- nt
Integer, number of time points.
- period
time periodicity
Value
A tibble with the original rows plus columns: `z_est` (posterior mean on log scale), `tausq` (approx. variance), `z_min`, `z_max` (95 `lambda_est`, `lambda_min`, `lambda_max`, and simple Negative-Binomial prediction summaries `negbin_size`, `negbin_prob`, `pred_Q2.5`, `pred_Q25`, `data_Q50`, `pred_Q75`, `pred_Q97.5`, plus `log_p`, `y_mode`, and `surprisal`.