Skip to contents

Constructs the exact training-point smoother matrix for a fitted fit.malps object, conditional on the stored supports, local charts, fitting weights, and averaging weights. For a non-robust MALPS fit or weighted refit with fixed supports, the returned matrix \(S\) satisfies \(\hat y = S y\). If the original fit used cross-validation, this matrix is conditional on the selected support profile; it does not account for the response-dependence of the model-selection step.

Usage

# S3 method for class 'malps'
smoother.matrix(object, max.n = 1000L, allow.robust = FALSE, ...)

Arguments

object

A "malps" object from fit.malps or refit.

max.n

Maximum number of training observations for which a dense smoother matrix may be constructed. Use Inf to disable this guard.

allow.robust

Logical; allow fixed-final-weight linearization for fits with robust.iterations > 0L.

...

Reserved for future extensions.

Value

A dense numeric \(n \times n\) matrix with attributes describing whether the matrix is conditional on support selection and whether it used a robust fixed-weight linearization.

Details

Robust residual reweighting makes the effective fitting weights depend on the response. By default this function therefore rejects robust MALPS fits. Setting allow.robust = TRUE constructs the fixed-final-weight linearization, which reproduces the stored fit but should not be interpreted as the exact response-to-fit map.

See also

smoother.matrix for supported fitted objects and migration.

Examples

X <- matrix(seq(0, 1, length.out = 20), ncol = 1)
fit <- fit.malps(X, X[, 1]^2, degree = 1L,
                 support.type = "knn", support.size = 8L)
S <- smoother.matrix(fit)
max(abs(S %*% fit$y - fit$fitted.values))
#> [1] 6.661338e-16