Package com.imsl.stat

Class LinearRegression.CaseStatistics

java.lang.Object
com.imsl.stat.LinearRegression.CaseStatistics
Enclosing class:
LinearRegression

public class LinearRegression.CaseStatistics extends Object
Inner Class CaseStatistics allows for the computation of predicted values, confidence intervals, and diagnostics for detecting outliers and cases that greatly influence the fitted regression.
  • Constructor Details

    • CaseStatistics

      public CaseStatistics(double[] x, double y)
      Deprecated.
      The CaseStatistics constructors have been deprecated in favor of getter methods in LinearRegression.
      Constructor for case statistics for an observation.
      Parameters:
      x - a double array containing the independent (explanatory) variables. Its length must be equal to the number of variables set in the LinearRegression constructor.
      y - a double representing the dependent (response) variable
    • CaseStatistics

      public CaseStatistics(double[] x, double y, double w)
      Deprecated.
      The CaseStatistics constructors have been deprecated in favor of getter methods in LinearRegression.
      Constructor for case statistics for an observation and a weight.
      Parameters:
      x - a double array containing the independent (explanatory) variables. Its length must be equal to the number of variables set in the constructor.
      y - a double representing the dependent (response) variable
      w - a double representing the weight
    • CaseStatistics

      public CaseStatistics(double[] x, double y, double w, int pred)
      Deprecated.
      The CaseStatistics constructors have been deprecated in favor of getter methods in LinearRegression.
      Constructor for case statistics for a new observation, weight, and future response count for the desired prediction interval.
      Parameters:
      x - a double array containing the independent (explanatory) variables. Its length must be equal to the number of variables set in the constructor.
      y - a double representing the dependent (response) variable
      w - a double representing the weight
      pred - an int representing the number of future responses for which the prediction interval is desired on the average of the future responses
    • CaseStatistics

      public CaseStatistics(double[] x, double y, int pred)
      Deprecated.
      The CaseStatistics constructors have been deprecated in favor of getter methods in LinearRegression.
      Constructor for case statistics for a new observation and future response count for the desired prediction interval.
      Parameters:
      x - a double array containing the independent (explanatory) variables. Its length must be equal to the number of variables set in the constructor.
      y - a double representing the dependent (response) variable
      pred - an int representing the number of future responses for which the prediction interval is desired on the average of the future responses.
  • Method Details

    • getCaseStatistics

      public double[] getCaseStatistics()
      Deprecated.
      Recommend using specific getter methods.
      Returns the case statistics for an observation.
      Returns:
      a double[12] array containing the case statistics. Elements 0 through 11 contain the following:

      Index Description
      0Observed response
      1 Predicted response
      2 Residual
      3 Leverage
      4 Standardized residual
      5 Jackknife residual
      6 Cook's distance
      7 DFFITS
      8,9 Confidence interval on the mean
      10,11 Prediction interval

    • getObservedResponse

      public double getObservedResponse()
      Returns the observed response for an observation.
      Returns:
      a double containing the observed response for an observation
    • getPredictedResponse

      public double getPredictedResponse()
      Returns the predicted response for an observation.
      Returns:
      a double containing the predicted response for an observation
    • getResidual

      public double getResidual()
      Returns the Residual for an observation.
      Returns:
      a double containing the residual for an observation
    • getLeverage

      public double getLeverage()
      Returns the Leverage for an observation.
      Returns:
      a double containing the Leverage for an observation
    • getStandardizedResidual

      public double getStandardizedResidual()
      Returns the Standardized Residual for an observation.
      Returns:
      a double containing the Standardized Residual for an observation
    • getJackknifeResidual

      public double getJackknifeResidual()
      Returns the Jackknife Residual for an observation.
      Returns:
      a double containing the Jackknife Residual for an observation
    • getCooksDistance

      public double getCooksDistance()
      Returns Cook's Distance for an observation.
      Returns:
      a double containing Cook's Distance for an observation
    • getDFFITS

      public double getDFFITS()
      Returns DFFITS for an observation.
      Returns:
      a double containing the DFFITS value for an observation
    • getConfidenceInterval

      public double[] getConfidenceInterval()
      Returns the Confidence Interval of the population mean for an observation.

      The width of the confidence interval depends on the confidence level set by setConLevelMean(double).

      Returns:
      a double[2] array containing the Confidence Interval of the population mean at the given observation.
    • getPredictionInterval

      public double[] getPredictionInterval()
      Returns the Prediction Interval of the predicted response for an observation.

      The width of the prediction interval depends on the confidence level set by setConLevelPred(double).

      Returns:
      a double[2] array containing the Prediction Interval of the predicted response at the given observation
    • setConLevelPred

      public void setConLevelPred(double conpcp)
      Sets the confidence level for two-sided prediction intervals.
      Parameters:
      conpcp - a double used to set the confidence level for two-sided prediction intervals of a predicted response. Note that conpcp must be in the interval 0 to 1 inclusive. That is, it must be expressed as a probability.

      Default: conpcp=.95.

    • setConLevelMean

      public void setConLevelMean(double conpcm)
      Sets the confidence level for two-sided confidence intervals of the population mean.
      Parameters:
      conpcm - a double used to set the confidence level for two-sided confidence intervals of the population mean. Note that conpcm must be in the interval 0 to 1 inclusive. That is, it must be expressed as a probability.

      Default: conpcm=.95.