public class RegressionAnalysis
extends java.lang.Object
Constructor and Description |
---|
RegressionAnalysis() |
Modifier and Type | Method and Description |
---|---|
static double |
calculateAdjRSquared(double rsq,
int n,
int k)
Returns the adjusted R-squared value for a linear regression model.
|
static double |
calculateFStat(double rsq,
int n,
int k)
Returns the F-statistic for a linear regression model.
|
static double |
calculateRSquared(Instances data,
double ssr)
Returns the R-squared value for a linear regression model, where sum of
squared residuals is already calculated.
|
static double |
calculateSSR(Instances data,
Attribute chosen,
double slope,
double intercept)
Returns the sum of squared residuals of the simple linear regression model:
y = a + bx.
|
static double[] |
calculateStdErrorOfCoef(Instances data,
Attribute chosen,
double slope,
double intercept,
int df)
Returns the standard errors of slope and intercept for a simple linear
regression model: y = a + bx.
|
static double[] |
calculateStdErrorOfCoef(Instances data,
boolean[] selected,
double ssr,
int n,
int k)
Returns an array of the standard errors of the coefficients in a multiple
linear regression.
|
static double[] |
calculateTStats(double[] coef,
double[] stderror,
int k)
Returns an array of the t-statistic of each coefficient in a multiple
linear regression model.
|
java.lang.String |
getRevision()
Returns the revision string.
|
public static double calculateSSR(Instances data, Attribute chosen, double slope, double intercept) throws java.lang.Exception
data
- (the data set)chosen
- (chosen x-attribute)slope
- (slope determined by simple linear regression model)intercept
- (intercept determined by simple linear regression model)java.lang.Exception
- if there is a missing class value in datapublic static double calculateRSquared(Instances data, double ssr) throws java.lang.Exception
data
- (the data set)ssr
- (sum of squared residuals)java.lang.Exception
- if there is a missing class value in datapublic static double calculateAdjRSquared(double rsq, int n, int k)
rsq
- (the model's R-squared value)n
- (the number of instances in the data)k
- (the number of coefficients in the model: k>=2)public static double calculateFStat(double rsq, int n, int k)
rsq
- (the model's R-squared value)n
- (the number of instances in the data)k
- (the number of coefficients in the model: k>=2)public static double[] calculateStdErrorOfCoef(Instances data, Attribute chosen, double slope, double intercept, int df) throws java.lang.Exception
data
- (the data set)chosen
- (chosen x-attribute)slope
- (slope determined by simple linear regression model)intercept
- (intercept determined by simple linear regression model)df
- (number of instances - 2)java.lang.Exception
- if there is a missing class value in datapublic static double[] calculateStdErrorOfCoef(Instances data, boolean[] selected, double ssr, int n, int k) throws java.lang.Exception
data
- (the data setselected
- (flags indicating variables used in the regression)ssr
- (sum of squared residuals)n
- (number of instances)k
- (number of coefficients; includes constant)java.lang.Exception
- if there is a missing class value in datapublic static double[] calculateTStats(double[] coef, double[] stderror, int k)
coef
- (array holding the value of each coefficient)stderror
- (array holding each coefficient's standard error)k
- (number of coefficients, includes constant)public java.lang.String getRevision()