Pointwise Variance and Confidence Band for a Fixed-Configuration LPS Fit
Source:R/lps_uncertainty.R
lps.pointwise.band.RdComputes, from the analytically extracted linear-smoother matrix S of a
fixed-configuration LPS fit (see smoother.matrix()), the pointwise
variance Var(fitted_i) = sigma^2 * sum_j S_ij^2, the effective degrees of
freedom df = tr(S), the plug-in noise estimate
sigma.hat^2 = RSS / (n - 2*tr(S) + sum(S^2)), and the pointwise confidence band
fitted_i +/- z * sigma * ||S_i.||_2 with
z = qnorm(1 - (1 - level) / 2).
Usage
lps.pointwise.band(
object,
sigma = NULL,
level = 0.95,
check.tol = 1e-10,
variance.method = c("residual", "legacy")
)Arguments
- object
A fitted
"lps"object fromfit.lps()at a fixed configuration, withX.evalidentical toX.- sigma
Known noise standard deviation (positive scalar), or
NULL(default) to use the plug-insigma.hat.- level
Confidence level of the band, a single number strictly between 0 and 1. Default
0.95. For independent errors with common variance and a fixed smoother, the expected residual sum of squares issigma^2 * sum((I - S)^2) + ||(I - S) mu||^2. The default denominator is therefore the residual noise degrees of freedom,n - 2*tr(S) + sum(S^2), computed assum((I - S)^2)for stability. This corrects the variance contribution; it cannot remove signal bias. Normal bands target the smoothed meanS mu. Their interpretation as bands formurequires negligible smoothing bias. Plug-in bands are approximate, pointwise, and conditional on the specified configuration; they do not account for tuning on the same responses, dependent errors, or simultaneous coverage.- check.tol
Passed to
smoother.matrix()'s self-guard.- variance.method
Noise-variance denominator:
"residual"(default) usessum((I - S)^2);"legacy"reproduces the formern - tr(S)rule. Neither removes smoothing bias. Added aftercheck.tolto preserve positional calls. The choice affectssigma.hateven when a knownsigmais supplied.
Value
A list of class "lps.pointwise.band" with named fields:
fitted (the fit's raw fitted values), se, variance, lower,
upper, level, z, sigma (the supplied known sigma, or NA in
plug-in mode), sigma.hat, sigma.source ("known" or "plug.in"),
df (tr(S)), residual.df, variance.method, rss, n.train, smoother.row.norm (||S_i.||_2),
and configuration (the pinned fit configuration).
Details
With sigma supplied (known noise standard deviation), the band uses it
directly (sigma.source = "known"); with sigma = NULL the plug-in
sigma.hat is used (sigma.source = "plug.in"). sigma.hat is reported
in both modes. The variance is purely the linear-smoother sampling
variance: the band makes no bias correction, so where bias dominates
(boundary, high curvature) undercoverage is expected and must be reported,
not masked.
Requires X.eval identical to X (the square training-fit smoother, on
which tr(S) and RSS are defined), in addition to all restrictions of
smoother.matrix(). If any evaluation point's local fit returned NA,
its variance/band entries are NA, and df, rss, and sigma.hat are
NA as well; supplying a known sigma still yields bands at the
unaffected points.
Examples
set.seed(1)
n <- 30
X <- matrix(runif(2 * n, -1, 1), ncol = 2)
y <- sin(pi * X[, 1]) + 0.1 * rnorm(n)
fit <- fit.lps(X, y, foldid = rep(1:2, length.out = n),
support.grid = 12L, degree.grid = 1L,
kernel.grid = "tricube", backend = "R",
design.basis = "orthogonal.polynomial.drop",
ridge.multiplier.grid = 0, ridge.condition.max = Inf,
unstable.action = "na")
band.known <- lps.pointwise.band(fit, sigma = 0.1)
band.plugin <- lps.pointwise.band(fit)
band.known$df
#> [1] 10.75683
band.plugin$sigma.hat
#> [1] 0.2206855