Class GLSMultipleLinearRegression

  • All Implemented Interfaces:

    public class GLSMultipleLinearRegression
    extends AbstractMultipleLinearRegression
    The GLS implementation of multiple linear regression. GLS assumes a general covariance matrix Omega of the error
     u ~ N(0, Omega)
    Estimated by GLS,
     b=(X' Omega^-1 X)^-1X'Omega^-1 y
    whose variance is
     Var(b)=(X' Omega^-1 X)^-1
    • Constructor Detail

      • GLSMultipleLinearRegression

        public GLSMultipleLinearRegression()
    • Method Detail

      • newSampleData

        public void newSampleData​(double[] y,
                                  double[][] x,
                                  double[][] covariance)
        Replace sample data, overriding any previous sample.
        y - y values of the sample
        x - x values of the sample
        covariance - array representing the covariance matrix
      • newCovarianceData

        protected void newCovarianceData​(double[][] omega)
        Add the covariance data.
        omega - the [n,n] array representing the covariance
      • getOmegaInverse

        protected RealMatrix getOmegaInverse()
        Get the inverse of the covariance.

        The inverse of the covariance matrix is lazily evaluated and cached.

        inverse of the covariance
      • calculateErrorVariance

        protected double calculateErrorVariance()
        Calculates the estimated variance of the error term using the formula
          Var(u) = Tr(u' Omega^-1 u)/(n-k)
        where n and k are the row and column dimensions of the design matrix X.
        calculateErrorVariance in class AbstractMultipleLinearRegression
        error variance