org.statcato.statistics.inferential
Class CorrelationRegression
- java.lang.Object
-
- org.statcato.statistics.inferential.CorrelationRegression
-
public class CorrelationRegression extends java.lang.ObjectLinear correlation and regression between for two variables.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor and Description CorrelationRegression(java.util.Vector<java.lang.Double> x, java.util.Vector<java.lang.Double> y, double sig)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubleCoefficientOfDetermination()Returns the coefficient of determination r^2, the amount of the variation in y that is explained by the regression line.doubleCriticalValue_r(double significance)Returns the critical value for r corresponding to the given significance.doubleCriticalValue_t(double significance)intDOF()Returns the degrees of freedom.doubleExplainedVariation()Returns the explained variation (sum of differences between the predicted y value and the mean).doubleLinearCorrelationCoeff()Returns the linear correlation coefficient.intN()Returns the number of data pairsjava.util.ArrayList<java.lang.Double>PredictedValues()Returns a list of predicated values in order.doublePValue()Returns the p-Value corresponding to the test statistic.doubleRegressionEqSlope()Returns the slope of the regression equation b1.doubleRegressionEqYInt()Returns the y-intercept of the regression equation b0.java.util.ArrayList<java.lang.Double>Residuals()Returns a list of residual values in order.doubleStandardError()doubleTestStatistic_t()Returns the test statistic t using the linear correlation correlation r.java.lang.StringtoString()doubleTotalVariation()Returns the total variation (sum of differences between the y value and the mean).doubleUnexplainedVariation()Returns the unexplained variation (sum of differences between the y value and the predicted y value).
-
-
-
Constructor Detail
-
CorrelationRegression
public CorrelationRegression(java.util.Vector<java.lang.Double> x, java.util.Vector<java.lang.Double> y, double sig)Constructor. The x and y variables are provided as vectors of double type of the same length. The values in the two vectors at the same position are considered to be a data point.- Parameters:
x- independent variabley- dependent variablesig- significance
-
-
Method Detail
-
N
public int N()
Returns the number of data pairs- Returns:
- n
-
DOF
public int DOF()
Returns the degrees of freedom.- Returns:
- DOF
-
LinearCorrelationCoeff
public double LinearCorrelationCoeff()
Returns the linear correlation coefficient.- Returns:
- r
-
TestStatistic_t
public double TestStatistic_t()
Returns the test statistic t using the linear correlation correlation r. t = r / sqrt((1 - r^2)/(n - 2)).- Returns:
- test statistic t
-
RegressionEqSlope
public double RegressionEqSlope()
Returns the slope of the regression equation b1.- Returns:
- b1 slope
-
RegressionEqYInt
public double RegressionEqYInt()
Returns the y-intercept of the regression equation b0.- Returns:
- b0 y-intercept
-
TotalVariation
public double TotalVariation()
Returns the total variation (sum of differences between the y value and the mean).- Returns:
- total variation
-
ExplainedVariation
public double ExplainedVariation()
Returns the explained variation (sum of differences between the predicted y value and the mean).- Returns:
- explained variation
-
UnexplainedVariation
public double UnexplainedVariation()
Returns the unexplained variation (sum of differences between the y value and the predicted y value).- Returns:
- unexplained variation
-
Residuals
public java.util.ArrayList<java.lang.Double> Residuals()
Returns a list of residual values in order.- Returns:
- ArrayList object containing the residuals
-
PredictedValues
public java.util.ArrayList<java.lang.Double> PredictedValues()
Returns a list of predicated values in order.- Returns:
- ArrayList object containing the predicted values
-
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 coefficient of determination
-
StandardError
public double StandardError()
-
CriticalValue_r
public double CriticalValue_r(double significance)
Returns the critical value for r corresponding to the given significance.- Parameters:
significance- significance- Returns:
- critical value (positive)
-
CriticalValue_t
public double CriticalValue_t(double significance)
-
PValue
public double PValue()
Returns the p-Value corresponding to the test statistic.- Returns:
- p-Value
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG