org.statcato.statistics.inferential
Class MultipleRegression2
- java.lang.Object
-
- org.statcato.statistics.inferential.MultipleRegression2
-
public class MultipleRegression2 extends java.lang.ObjectMultiple regression for non-linear models. Variations (explained, unexplained, total) are calculated using matrix operations.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor and Description MultipleRegression2(java.util.Vector<java.util.Vector<java.lang.Double>> IndependentVars, java.util.Vector<java.lang.Double> DependentVar, boolean hasConstant)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubleAdjustedCoefficientOfDetermination()Returns the adjusted coefficient of determination.doubleCoefficientOfDetermination()Returns the coefficient of determination r^2, the amount of the variation in y that is explained by the regression line.doubleExplainedVariation()Returns the explained variation (SSR, the sum of squared differences between the predicted y value and the average y value).intNumIndepVar()Returns the number of independent variables.doublePValue()Returns the p-Value of test statistics.MatrixRegressionEqCoefficients()Returns the coefficients of the regression equation y = b_0 + b_1 * x_1 + ...intSampleSize()Returns the sample size.doubleStandardError()Returns the standard error of estimate, sqrt(unexplained variation / (n-2)).doubleTestStatistics()Returns the test statistics F.java.lang.StringtoString()doubleTotalVariation()Returns the total variation (SST, the sum of squared differences between the y values and the average y value).doubleUnexplainedVariation()Returns the unexplained variation (the sum of squared differences between the predicted y value and the y value).MatrixXVar(int i)Returns the i th value of all the independent variables as a 1 by k matrix.doubleYPredicted(Matrix var)Returns the predicted y value given a vector of values of the independent variables using the regression equation.
-
-
-
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 valuesDependentVar- a vector of double, which has the same number of values as the independent variables
-
-
Method Detail
-
RegressionEqCoefficients
public 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(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 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:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG