LinReg
jhplot.stat

Class LinReg



  • public class LinRegextends Object
    A linear regression analysis.
    • Constructor Detail

      • LinReg

        public LinReg(double[] aX,      double[] aY)
        Constructor for regression calculations
        Parameters:
        aX - is the array of x data
        aY - is the array of y data
      • LinReg

        public LinReg(P1D aXY)
        constructor for regression calculations. It should be noted that only X and Y values from the input P1D data holder are used
        Parameters:
        aXY - P1D container for X and Y values
    • Method Detail

      • reset

        public void reset()
        reset data to 0
      • getCorrelation

        public double getCorrelation()
        Get correlation coefficient
        Returns:
        Correlation coefficient.
      • getIntercept

        public double getIntercept()
        Get Intercept
        Returns:
        Intercept
      • getInterceptError

        public double getInterceptError()
        Get the standard error on intercept
        Returns:
        standard error on intercept
      • getSlopeError

        public double getSlopeError()
        Get the standard error on slope
        Returns:
        standard error on slope
      • getSlope

        public double getSlope()
        Get slope
        Returns:
        slope
      • getResiduals

        public P1D getResiduals()
        Get residuals
        Returns:
        P1D array with residuals
      • getDataX

        public double[] getDataX()
        Get an array with X data
        Returns:
        array with X data
      • getDataY

        public double[] getDataY()
        Get an array with Y data
        Returns:
        array with Y data
      • addPoint

        public void addPoint(double xValue,            double yValue)
        Add a point to the data and redo the regression
        Parameters:
        xValue - X value
        yValue - Y value
      • getMinX

        public double getMinX()
        Get a minimum value for X
        Returns:
        Minimum value
      • getMaxX

        public double getMaxX()
        Get a maximum value for X
        Returns:
        Max value in X
      • getMinY

        public double getMinY()
        Get minimum value for Y
        Returns:
        minimum Y value
      • getMaxY

        public double getMaxY()
        Get maximum value in Y
        Returns:
        Maximum value in Y
      • getMaxAbsoluteResidual

        public double getMaxAbsoluteResidual()
        Get max absolute residual
        Returns:
        max absolute residual
      • getSxx

        public double getSxx()
        Get Sxx value: sumXsquared - sumX * sumX / n
        Returns:
        Sxx
      • getSyy

        public double getSyy()
        Get SYY value: sumYsquared - sumY * sumY / n
        Returns:
        Syy valye
      • getSSR

        public double getSSR()
        Ger SSR value
        Returns:
        SSR value
      • getSSE

        public double getSSE()
        Get SSE value
        Returns:
        SSE value
      • getMSE

        public double getMSE()
        Get MSE value
        Returns:
        MSE value
      • getXBar

        public double getXBar()
        Get average x
        Returns:
        average X
      • getYBar

        public double getYBar()
        Get average Y
        Returns:
        average Y
      • getDataLength

        public int getDataLength()
        Get the size of the input data
        Returns:
        size of data array
      • getPearsonR

        public double getPearsonR()
        Get pearson R
        Returns:
        pearson R
      • getSumXSquared

        public double getSumXSquared()
        Get sun of the square
        Returns:
        sum of the square
      • getResult

        public F1D getResult()
        Get the linear regression result
        Returns:
        Resulting function
      • getConfidence

        public P1D[] getConfidence()
        Get confidence intervals for means
        Returns:
        P1D[2] for lower and high
      • getConfidence

        public P1D[] getConfidence(Color color)
        Get confidence intervals for means
        Parameters:
        color - color used to draw
        Returns:
        P1D[2] for lower and high
      • getPrediction

        public P1D[] getPrediction()
        Get prediction lines
        Returns:
        P1D[2] for lower and high
      • getPrediction

        public P1D[] getPrediction(Color color)
        Get prediction lines
        Parameters:
        color - color used to draw
        Returns:
        P1D[2] for lower and high
      • getConfidenceBand

        public P1D getConfidenceBand(Color color,                    double transparency)
        Calculate confidence band in form of P1D with errors. The number of total points for P1D is set to 100 by default.
        Parameters:
        color - Color used to show the band
        transparancy - level of color transparency (between 0 and 1)
        Returns:
        P1D with fit values. Errors show the confidence band
      • getConfidenceBand

        public P1D getConfidenceBand(int Npoints,                    Color color,                    double transparency)
        Calculate confidence band in form of P1D with errors.
        Parameters:
        Npoints - number of points to display the band
        color - Color used to show the band
        transparancy - level of color transparency (between 0 and 1)
        Returns:
        P1D with fit values. Errors show the confidence band
      • getPredictionBand

        public P1D getPredictionBand()
        Calculate the prediction band in form of P1D with errors. The number of total points for P1D is set to 100 by default.
        Returns:
        P1D with fit values. Errors show the prediction band
      • getPredictionBand

        public P1D getPredictionBand(Color color)
        Calculate the prediction band in form of P1D with errors. The number of total points for P1D is set to 100 by default.
        Parameters:
        color - Color used to show the band
        Returns:
        P1D with fit values. Errors show the prediction band
      • getPredictionBand

        public P1D getPredictionBand(Color color,                    double transparency)
        Calculate the prediction band in form of P1D with errors. The number of total points for P1D is set to 100 by default.
        Parameters:
        color - Color used to show the band
        transparancy - level of color transparency (between 0 and 1)
        Returns:
        P1D with fit values. Errors show the prediction band
      • getPredictionBand

        public P1D getPredictionBand(int Npoints,                    Color color,                    double transparency)
        Calculate the prediction band in form of P1D with errors.
        Parameters:
        Npoints - number of points for evaluation
        color - Color used to show the band
        transparancy - level of color transparency (between 0 and 1)
        Returns:
        P1D with fit values. Errors show the prediction band
      • doc

        public void doc()
        Show online documentation.

SCaVis 1.7 © jWork.org