Class LARSProblem


  • public class LARSProblem
    extends LMProblem
    Least Angle Regression (LARS) is a regression algorithm for high-dimensional data. Suppose we expect a response variable to be determined by a linear combination of a subset of potential covariates. Then the LARS algorithm provides a means of producing an estimate of which variables to include, as well as their coefficients. The algorithm is similar to forward stepwise regression, but instead of including variables at each step, the estimated parameters are increased in a direction equiangular to each one's correlations with the residual.
    See Also:
    • B. Efron et. al, "Least Angle Regression," The Annals of Statistics, Volume: 32(2), 407 - 499, 2004.
    • T. Hastie, R. Tibshirani and J. Friedman, "The Elements of Statistical Learning: Data Mining, Inference, and Prediction (Second Edition)," New York, Springer-Verlag, 2009.
    • Wikipedia: Least angle regression
    • Constructor Summary

      Constructors 
      Constructor Description
      LARSProblem​(Vector y, Matrix X)
      Constructs a LASSO variation of the Least Angel Regression (LARS) problem, where an intercept is included in the model and the covariates are normalized first.
      LARSProblem​(Vector y, Matrix X, boolean lasso)
      Constructs a Least Angel Regression (LARS) problem, where an intercept is included in the model and the covariates are normalized first.
      LARSProblem​(Vector y, Matrix X, boolean normalized, boolean lasso)
      Constructs a Least Angel Regression (LARS) problem, where an intercept is included in the model.
      LARSProblem​(Vector y, Matrix X, boolean intercept, boolean normalized, boolean lasso)
      Constructs a Least Angel Regression (LARS) problem.
      LARSProblem​(LARSProblem that)
      Copy constructor.
    • Constructor Detail

      • LARSProblem

        public LARSProblem​(Vector y,
                           Matrix X,
                           boolean intercept,
                           boolean normalized,
                           boolean lasso)
        Constructs a Least Angel Regression (LARS) problem.
        Parameters:
        y - the vector of response variable (n * 1)
        X - the matrix of covariates (n * m)
        intercept - an indicator of whether an intercept is included in the model
        normalized - an indicator of whether the covariates are first normalized to have unit L2 norm
        lasso - an indicator of whether LASSO variation is used
      • LARSProblem

        public LARSProblem​(Vector y,
                           Matrix X,
                           boolean normalized,
                           boolean lasso)
        Constructs a Least Angel Regression (LARS) problem, where an intercept is included in the model.
        Parameters:
        y - the vector of response variable (n * 1)
        X - the matrix of covariates (n * m)
        normalized - an indicator of whether the covariates are first normalized to have unit L2 norm
        lasso - an indicator of whether LASSO variation is used
      • LARSProblem

        public LARSProblem​(Vector y,
                           Matrix X,
                           boolean lasso)
        Constructs a Least Angel Regression (LARS) problem, where an intercept is included in the model and the covariates are normalized first.
        Parameters:
        y - the vector of response variable (n * 1)
        X - the matrix of covariates (n * m)
        lasso - an indicator of whether LASSO variation is used
      • LARSProblem

        public LARSProblem​(Vector y,
                           Matrix X)
        Constructs a LASSO variation of the Least Angel Regression (LARS) problem, where an intercept is included in the model and the covariates are normalized first.
        Parameters:
        y - the vector of response variable (n * 1)
        X - the matrix of covariates (n * m)
      • LARSProblem

        public LARSProblem​(LARSProblem that)
        Copy constructor.
        Parameters:
        that - another LeastAngelRegressionProblem
    • Method Detail

      • m

        public int m()
        Gets the number of covariates (number of columns of X), excluding the intercept.
        Returns:
        the number of covariates
      • isLASSO

        public boolean isLASSO()
        Checks if the LASSO variation of LARS is used.
        Returns:
        true if the LASSO variation of LARS is used
      • yMean

        public double yMean()
        Gets the mean to be subtracted from the response variable (0 if no intercept is included).
        Returns:
        the mean to be subtracted from the response variable
      • XMean

        public Vector XMean()
        Gets the mean vector to be subtracted from the covariates (a vector of zeros if no intercept is included).
        Returns:
        the mean vector to be subtracted from the covariates
      • XL2Norm

        public Vector XL2Norm()
        Gets the L2 norms of the covariates (a vector of ones if no standardization is required).
        Returns:
        the L2 norm of the covariates
      • yLARS

        public Vector yLARS()
        Gets the vector of response variable (possibly demeaned) to be used in LARS.
        Returns:
        the the vector of response variable (possibly demeaned) to be used in LARS
      • XLARS

        public Matrix XLARS()
        Gets the matrix of covariates (possibly demeaned and/or scaled) to be used in LARS.
        Returns:
        the matrix of covariates (possibly demeaned and/or scaled) to be used in LARS