Computes exact leave-one-out (LOO) predictive summaries from a fitted exact Gaussian-process model without refitting the model once per observation. The calculation uses the fitted precision diagonal implied by the stored Cholesky factor.
Value
A data frame with observed values, LOO predictive means and variances, residuals, standardized residuals, probability integral transform (PIT) values, interval bounds, coverage indicators, and pointwise log predictive densities.
Details
When numerical jitter was required during fitting, the LOO calculation
necessarily reflects the stabilized covariance used in that factorization;
the amount of jitter is reported separately by gp_numerical_diagnostics().
Estimated mean coefficients stay at their full-data estimate, as in
predict_gp(). Marginalized coefficients are integrated out as in the
posterior: the precision diagonal is that of
\(P_A = C^{-1} - C^{-1} H (B^{-1} + H^\top C^{-1} H)^{-1} H^\top C^{-1}\),
so with a vague prior each prediction re-estimates the coefficients
without the left-out observation.
Stability
Stable: from version 1.0.0 this interface changes incompatibly only in a major release, after a deprecation period. Results and options that concern an experimental model class, kernel, or argument follow that interface's tier. See gaussianprocesses-package for the policy.
Examples
x <- seq(-2, 2, length.out = 20)
model <- fit_gp(
x,
sin(2 * x),
kernel = rbf_kernel(length_scale = 0.6),
noise_variance = 0.01
)
loo <- loo_gp(model)
head(loo[, c("observed", "mean", "sd", "pit", "covered")])
#> observed mean sd pit covered
#> 1 0.75680250 0.64210988 0.2491590 0.6773563 TRUE
#> 2 0.42354465 0.43621748 0.1369706 0.4631416 TRUE
#> 3 0.01630136 0.02684788 0.1347456 0.4688067 TRUE
#> 4 -0.39378948 -0.39534656 0.1304657 0.5047612 TRUE
#> 5 -0.73509255 -0.73747001 0.1304655 0.5072695 TRUE
#> 6 -0.94798850 -0.94360447 0.1295707 0.4865043 TRUE