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

    Constructors
    Constructor
    Description
    Constructs 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 Type
    Method
    Description
    double[]
    residuals(double[] y, double[][] preds)
    Regresses y on the predictors (with an intercept) and returns the residuals.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      residuals in interface WildBootstrapMarkovCheck.Residualizer
      Parameters:
      y - length-n response.
      preds - d predictor columns, each length n.
      Returns:
      length-n residual vector.