org.statcato.statistics.inferential
Class MultipleRegression2

java.lang.Object
  extended by org.statcato.statistics.inferential.MultipleRegression2

public class MultipleRegression2
extends java.lang.Object

Multiple regression for non-linear models. Variations (explained, unexplained, total) are calculated using matrix operations.

Since:
1.0
Version:
%I%, %G%
Author:
Margaret Yau

Constructor Summary
MultipleRegression2(java.util.Vector<java.util.Vector<java.lang.Double>> IndependentVars, java.util.Vector<java.lang.Double> DependentVar, boolean hasConstant)
          Constructor.
 
Method Summary
 double AdjustedCoefficientOfDetermination()
          Returns the adjusted coefficient of determination.
 double CoefficientOfDetermination()
          Returns the coefficient of determination r^2, the amount of the variation in y that is explained by the regression line.
 double ExplainedVariation()
          Returns the explained variation (SSR, the sum of squared differences between the predicted y value and the average y value).
 int NumIndepVar()
          Returns the number of independent variables.
 double PValue()
          Returns the p-Value of test statistics.
 Jama.Matrix RegressionEqCoefficients()
          Returns the coefficients of the regression equation y = b_0 + b_1 * x_1 + ...
 int SampleSize()
          Returns the sample size.
 double StandardError()
          Returns the standard error of estimate, sqrt(unexplained variation / (n-2)).
 double TestStatistics()
          Returns the test statistics F.
 java.lang.String toString()
           
 double TotalVariation()
          Returns the total variation (SST, the sum of squared differences between the y values and the average y value).
 double UnexplainedVariation()
          Returns the unexplained variation (the sum of squared differences between the predicted y value and the y value).
 Jama.Matrix XVar(int i)
          Returns the i th value of all the independent variables as a 1 by k matrix.
 double YPredicted(Jama.Matrix var)
          Returns the predicted y value given a vector of values of the independent variables using the regression equation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultipleRegression2

public MultipleRegression2(java.util.Vector<java.util.Vector<java.lang.Double>> IndependentVars,
                           java.util.Vector<java.lang.Double> DependentVar,
                           boolean hasConstant)
Constructor.

Parameters:
IndependentVars - a vector of vectors of double, where each vector is an independent variable with the same number of values
DependentVar - a vector of double, which has the same number of values as the independent variables
Method Detail

RegressionEqCoefficients

public Jama.Matrix RegressionEqCoefficients()
Returns the coefficients of the regression equation y = b_0 + b_1 * x_1 + ... + b_k * x_k as a matrix of dimension k+1 by 1: [b_0 b_1 ... b_k]'.

Returns:
a k+1 by 1 matrix containing the coefficients of the regression equation

YPredicted

public double YPredicted(Jama.Matrix var)
Returns the predicted y value given a vector of values of the independent variables using the regression equation.

Parameters:
var - a vector of double that has the same number of values as the number of independent variables.
Returns:
predicted y value

TotalVariation

public double TotalVariation()
Returns the total variation (SST, the sum of squared differences between the y values and the average y value).

Returns:
total variation

XVar

public Jama.Matrix XVar(int i)
Returns the i th value of all the independent variables as a 1 by k matrix.

Parameters:
i - index
Returns:
matrix

ExplainedVariation

public double ExplainedVariation()
Returns the explained variation (SSR, the sum of squared differences between the predicted y value and the average y value).

Returns:
explained variation

UnexplainedVariation

public double UnexplainedVariation()
Returns the unexplained variation (the sum of squared differences between the predicted y value and the y value).

Returns:
unexplained variation

CoefficientOfDetermination

public double CoefficientOfDetermination()
Returns the coefficient of determination r^2, the amount of the variation in y that is explained by the regression line.

Returns:
r^2

AdjustedCoefficientOfDetermination

public double AdjustedCoefficientOfDetermination()
Returns the adjusted coefficient of determination.

Returns:
r^2

StandardError

public double StandardError()
Returns the standard error of estimate, sqrt(unexplained variation / (n-2)).

Returns:
s

TestStatistics

public double TestStatistics()
Returns the test statistics F. F = (explained variation) / (unexplained variation) * (n - k - 1) / k

Returns:
test statistics F

PValue

public double PValue()
Returns the p-Value of test statistics.

Returns:
p-Value

SampleSize

public int SampleSize()
Returns the sample size.

Returns:
n

NumIndepVar

public int NumIndepVar()
Returns the number of independent variables.

Returns:
k

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object