Class WildBootstrapMarkovCheck.OlsResidualizer
java.lang.Object
edu.cmu.tetrad.search.WildBootstrapMarkovCheck.OlsResidualizer
- All Implemented Interfaces:
WildBootstrapMarkovCheck.Residualizer
- Enclosing class:
WildBootstrapMarkovCheck
public static final class WildBootstrapMarkovCheck.OlsResidualizer
extends Object
implements WildBootstrapMarkovCheck.Residualizer
Ordinary least squares residualization. Treats all predictors as continuous.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an OLS residualizer with the default ridge of 1e-10.OlsResidualizer(double ridge) Constructs an OLS residualizer with a given ridge. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]residuals(double[] y, double[][] preds) Regresses y on the predictors (with an intercept) and returns the residuals.
-
Constructor Details
-
OlsResidualizer
public OlsResidualizer()Constructs an OLS residualizer with the default ridge of 1e-10. -
OlsResidualizer
public OlsResidualizer(double ridge) Constructs an OLS residualizer with a given ridge.- Parameters:
ridge- added to the diagonal of X'X for numerical stability; a singular system yields zero coefficients rather than an exception.
-
-
Method Details
-
residuals
public double[] residuals(double[] y, double[][] preds) Regresses y on the predictors (with an intercept) and returns the residuals. With no predictors this returns y minus its mean.- Specified by:
residualsin interfaceWildBootstrapMarkovCheck.Residualizer- Parameters:
y- length-n response.preds- d predictor columns, each length n.- Returns:
- length-n residual vector.
-