Calculation STATBEANS®

 

STATBEAN Name: ANOVA

Purpose: Statgraphics ANOVA software calculates an analysis of variance involving one or more factors. This STATBEAN calculates ANOVA with Java using JavaBeans.

DataSource For Statgraphics ANOVA software: any. 

Read/Write Properties

Name Type Description Possible Values Default Value
cVariableNames String[] The names of the columns with data values to be used for any covariates. Any string. ""
largestInteraction int the largest interaction to be estimated. >=1 2
tablewiseExclusion boolean Whether all rows of the data table containing a missing value in any column should be excluded from the calculations. true,false false
tolerance double Conditioning tolerance for aborting matrix inversion. >0 and <=0.000001 0.0000000001
xVariableNames String[] The names of the columns with data values to be used for the factor (X) variables. Any string. ""
yVariableName String The name of the column with data values to be used for the dependent (Y) variable. Any string. "Y"


Other Public Methods To Use For Statgraphics ANOVA Software

Name Description Arguments Return Value
void excludeInteraction(int factor1,int factor2,boolean exclude) Excludes a selected interaction. Number of 1st factor, number of 2nd factor, exclude or not. None.
double getAdjustedRSquared() Returns the adjusted coefficient of determination. None. Adjusted R-squared, or missingValueCode if model cannot be fit.
void getDegreesOfFreedom(int df[3]) Returns the degrees of freedom corresponding to the sums of squares. Integer output array. None.
void getDF(int df[numberOfEffects]) Returns the degrees of freedom corresponding to each effect. Integer output array. None.
double getDurbinWatson() Returns the Durbin-Watson statistic. None. DW, or missingValueCode if model cannot be fit.
double getEffectFRatio(int k) Returns the F-ratio for effect k. Effect index. F-ratio.
double getEffectPValue(int k) Returns the P-value for effect k. Effect index. P-value.
String getFactorString() Returns string with effect indicators. None. Consecutive 8-character strings such as AB identifying each effect.
double getGrandMean() Returns the overall mean. None. Grand mean.
void getLSMeans(double[numberOfLevels]) Returns the calculated least squares means for each level. Double output array. None.
void getLSSigmas(double[numberOfLevels]) Returns the standard errors of the calculated least squares means for each level. Double output array. None.
double getMeanAbsoluteError() Returns the residual mean absolute error. None. MAE, or missingValueCode if model cannot be fit.
double getMeanSquaredError() Returns the residual mean squared error. None. MSE, or missingValueCode if model cannot be fit.
double getModelPValue() Returns the P-value for the fitted model. None. P-value.
int getNumberOfLevels() Returns the number of levels for all main effects and interactions combined. None. Number of levels.
int getNumberOfEffects() Returns the number of main effects and interactions. None. Number of effects.
int getNumberOfFactors() Returns the number of factors. None. Number of factors.
void getPredictedValues(double p[n]) Returns the predicted value of Y corresponding to each row in the datasource. Double output array. None.
double getResidualDegreesOfFreedom() Returns the d.f. for the error term used to estimate the standard errors. None. Residual df, or 0 if model cannot be fit.
void getResiduals(double r[n]) Returns the residual corresponding to each row in the datasource. Double output array. Residual or missingValueCode.
double getResidualStandardError() Returns the estimated standard deviation of the residuals. None. Standard error of the estimate, or missingValueCode if model cannot be fit.
double getRSquared() Returns the coefficient of determination. None. R-squared, or missingValueCode if model cannot be fit.
double getSampleSize() Returns the number of non-missing data values. None. Sample size.
void getSumsOfSquares(double ss[3]) Returns the following sums of squares: total, model, residual. Double output array. None.
void getTypeISumsOfSquares(double[]) Returns the reduction in the residual sum of squares as each variable is entered into the model. Double output array. None.
void getTypeIIISumsOfSquares(double[]) Returns the reduction in the residual sum of squares if each variable is entered last into the model. Double output array. None.


Output Variables

Name Description
Predicted The predicted value of Y corresponding to each row in the datasource.
Residual The residual corresponding to each row in the datasource.


Other properties are inherited from the general CalculationStatbean class. 

Code Sample 

//create a datasource bean 
FileDataSource fileDataSource1 = new STATBEANS.FileDataSource(); 

//set the file name to be read 
fileDataSource1.setFileName("c:\\statbeans\\samples\\cardata2.txt"); 

//create a calculation bean 
Anova anova1 = new STATBEANS.Anova(); 

//set the column names 
anova1.setYVariableName("mpg"); 
java.lang.String[] tempString = new String[2]; 
tempString[0] = "origin"; 
tempString[1] = "year"; 
anova1.setXVariableNames(tempString); 

//create a table bean 
AnovaTable anovaTable1 = new STATBEANS.AnovaTable(); 

//define the desired elements to display 
anovaTable1.setShowANOVA(true); 
anovaTable1.setShowDependentVariable(true); 
anovaTable1.setShowMeans(true); 
anovaTable1.setShowStatistics(false); 

//make the calculation bean a listener for changes in the FileDataSource bean 
fileDataSource1.addDataChangeListener(anova1.listenerForDataChange); 

//make the table bean a listener for changes in the calculation bean 
anova1.addDataChangeListener(anovaTable1.listenerForDataChange); 

//instruct the fileDataSource bean to read the file 
fileDataSource1.readData(); 

NOTES 
Use the excludeFactor method to selectively remove two-factor interactions from the model. For example, to remove interaction AC, execute excludeFactor(1,3,true). Note that when retrieving effect sums of squares, degrees of freedom, F ratios, or P values, positions for the excluded factors remain in the output arrays but should be ignored.