nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
nk::stats::RobustfitResult Struct Reference

Robust linear regression via iteratively-reweighted least squares ([b, stats] = robustfit(X, y)). More...

#include <regress.hpp>

Public Attributes

Value b
 Robust regression coefficient vector.
Value s
 Robust scale estimate.

Detailed Description

Robust linear regression via iteratively-reweighted least squares ([b, stats] = robustfit(X, y)).

Fits y = X · b + ε while downweighting outliers. Algorithm (matches MATLAB's statrobustfit.m):

  1. Initial OLS β; leverage adjustment radj = r / sqrt(1 - h) where h is the hat-matrix diagonal (DuMouchel & O'Brien).
  2. Loop: scale s = madsigma(radj, p) (median of the largest n-p+1 of |radj|, /0.6745); weights w_i = ψ(radj_i / (max(s, tiny_s) · tune)) for one of the 9 MATLAB weight functions; refit β via weighted LS.
  3. Stop on convergence or 50 iterations.

The intercept column is prepended by the robustfit builtin (const='on' default). KNOWN GAP: the full stats output struct (degrees of freedom, p-values, etc.) is reduced to scalar s.

Parameters
XDesign matrix (n × p).
yResponse (n × 1).
weightWeight function (Bisquare default; full MATLAB set: Andrews/Bisquare/Cauchy/Fair/Huber/Logistic/Ols/

Result of robust regression ([b, stats] = robustfit(X, y)).

Definition at line 185 of file regress.hpp.

Member Data Documentation

◆ b

Value nk::stats::RobustfitResult::b

Robust regression coefficient vector.

Definition at line 186 of file regress.hpp.

◆ s

Value nk::stats::RobustfitResult::s

Robust scale estimate.

Definition at line 187 of file regress.hpp.


The documentation for this struct was generated from the following file: