Skip to contents

Computes the posterior mean of \(\lambda = \exp(z)\) where \(z = f + \mu_{\mathrm{infer}}\). The latent field \(f\) follows a zero–mean GP with separable covariance \(K = K_{\mathrm{space}} \otimes K_{\mathrm{time}}\). A Gaussian working likelihood on the log scale with heteroscedastic diagonal variance \(D = \mathrm{diag}(\text{noise\_var})\) is used. This evaluates $$f_{\text{hat}} = K S^\top (S K S^\top + D)^{-1} y_{\text{work}},$$ then returns \(\exp(f_{\text{hat}} + \mu_{\mathrm{infer}})\).

Usage

gp_posterior_mean(state, tol = 1e-06)

Arguments

state

A sampler state created by gp_build_state(), containing at least space_mat, time_mat, obs_idx, N, y_work, noise_var, kdiag_full, A_solve, and mu_infer. The vector layout is sites × times with time varying fastest.

tol

Convergence tolerance passed to the inner PCG solve.

Value

A numeric vector of length state$N giving the posterior mean intensity \(\lambda\) in the same ordering as state$mu_infer.