Skip to contents

Reuses the anchors, selected support profile, local supports, prediction supports, coordinate method, kernel, degree, and local-solver controls from a previous fit.malps result, then recomputes local polynomial coefficients for a new response vector. Observation weights, when supplied, multiply the stored geometric fitting weights for local coefficient estimation. Supports and model-averaging weights remain fixed. A weighted refit requires every stored local support to retain at least one positive effective fitting weight; sparse bootstrap-style weights can therefore fail even when the global weight vector is not all zero. If the original fit used robust local residual reweighting, robust weights are recomputed for the new response because they are response-dependent.

Usage

# S3 method for class 'malps'
refit(
  object,
  y = NULL,
  weights = NULL,
  reuse.selection = TRUE,
  refit.local.coefficients = TRUE,
  verbose = FALSE,
  ...
)

Arguments

object

A "malps" object from fit.malps.

y

Optional new numeric response vector with length nrow(object$X). If NULL, the original response is reused.

weights

Optional nonnegative numeric observation weights with length nrow(object$X). Zero weights remove observations from local coefficient estimation but do not change the stored supports or averaging weights. The refit fails if any local support has no positive effective fitting weight after multiplying by these observation weights.

reuse.selection

Currently requires TRUE.

refit.local.coefficients

Currently requires TRUE.

verbose

Logical; reserved for future progress messages.

...

Reserved for future extensions.

Value

A "malps" object with the same support profile and new fitted values.

See also

refit 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)
refit(fit, y = X[, 1]^3)
#> Model-averaged local polynomial smoothing fit
#>   n: 20 
#>   anchors: 20 
#>   degree: 1 
#>   support.metric: coordinates 
#>   support.type: knn 
#>   kernel: epanechnikov 
#>   min coverage: 5 
#>   finite predictions: TRUE