Click or drag to resize

TwoWayAnovaUnbalanced Class

Class TwoWayAnovaUnbalanced is the base class for performing a two way ANOVA when the number of observations in each cell is not the same (an unbalanced design). In this case the main and interaction effects are interdependent, and we must obtain the marginal sum of squares associated with each factor after all the other factors have already been included in the model (the marginal sum of squares for each variable equals the incremental sum of squares for that variable when it is entered into the equation last). In terms of a regression approach to ANOVA, the marginal sum of squares due to a factor is the sum of squares for the set of dummy variables associated with that factor when those dummy variables are entered into the model last, after all other dummy variables. Classes deriving from TwoWayAnovaUnbalanced provide the ordering of dummy regression variables and use the base class to compute the resulting regressions and sums of squares.
Inheritance Hierarchy

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 7.4
Syntax
[SerializableAttribute]
public class TwoWayAnovaUnbalanced : TwoWayAnovaBase

The TwoWayAnovaUnbalanced type exposes the following members.

Constructors
  NameDescription
Protected methodTwoWayAnovaUnbalanced
Constructs a TwoWayAnovaUnbalanced.
Top
Properties
  NameDescription
Public propertyAnovaTable
Gets the ANOVA table.
Public propertyFactorARegressionFactorParameters
Gets the ANOVAs for the factor A regression parameters.
Public propertyFactorBRegressionFactorParameters
Gets the ANOVAs for the factor B regression parameters.
Public propertyGrandMean
Gets the grand mean.
(Overrides TwoWayAnovaBaseGrandMean.)
Public propertyInteractionRegressionFactorParameters
Gets the ANOVAs for the interaction regression parameters.
Public propertyRegressionInterceptParameter
Bets the ANOVA regression parameter object associated with the intercept parameter.
(Overrides TwoWayAnovaBaseRegressionInterceptParameter.)
Top
Methods
  NameDescription
Protected methodComputeBalancedAnova
Computes the ANOVA in the case that the design is acutally balanced. This can greatly increase performance if an unbalanced ANOVA class is used to perform an ANOVA on a data set that is in fact balanced (same number of observations in each cell).
Protected methodComputeFactorSumsOfSquares(DoubleMatrix)
Fill in the DoubleVector parameterSumsOfSquares_ with the sums of squares for the parameters used in the regression that is used to compute the ANOVA.
(Inherited from TwoWayAnovaBase.)
Protected methodComputeFactorSumsOfSquares(DoubleMatrix, TwoWayAnovaUnbalancedParameterOrder, TwoWayAnovaUnbalancedParameterSlices)
Compute the factor sums of squares.
Protected methodComputeFactorSumsOfSquares(LinearRegression, Int32, Int32, Int32)
Fill in the DoubleVector parameterSumsOfSquares_ with the sums of squares for the parameters used in the regression that is used to compute the ANOVA.
(Inherited from TwoWayAnovaBase.)
Public methodGetCellData
Returns all the data in a cell, as defined by the levels of the two factors in the ANOVA.
(Inherited from TwoWayAnovaBase.)
Protected methodGetFactorSumOfSquares
For a given parameter order, retrives the sum of squares for the regression parameters associated with the last factor, or interaction, in the order.
Public methodGetMeanForCell
Returns the mean for the specified cell, as defined by the levels of the two factors in the ANOVA.
(Inherited from TwoWayAnovaBase.)
Public methodGetMeanForFactorLevel
Returns the mean for the specified factor level.
(Inherited from TwoWayAnovaBase.)
Protected methodGetOrderedRegression
Create the ordered linear regession object for the data and given coefficient ordering.
Protected methodGetParameterSlices
For a give ANOVA regression factor/interaction parameter order, computes the slices to access the columns of the regression matrix for the factor and interaction parameters.
Protected methodIncrementalSumOfSquares(LinearRegression, Int32, DoubleVector, Double)
Protected methodIncrementalSumOfSquares(DoubleMatrix, Int32, DoubleVector, Double, Factor, AnovaRegressionFactorParam)
Computes the incremental sum of squares when adding numParameters to the regression model. The columns corresponding these parameters are assumed to be the last numParameter columns in the given regression matrix.
Protected methodInitializeFactorsAndCellData
Consumes the ANOVA data from a DataFrame.
Protected methodInterceptParameterSumOfSquares
Compte the sum of squares associated with the regression's intercept parameter.
(Inherited from TwoWayAnovaBase.)
Protected methodMakeCellData
Fills in the cell data for a two way ANOVA from the given data frame and column information.
(Inherited from TwoWayAnovaBase.)
Protected methodMakeFactorParameters(LinearRegression, DoubleVector, Int32, Factor)
Create the array of AnovaRegressionFactorParam objects, one for each regression dummy variable. The sums of squares for each of these parameters is assumed to have been computed are are stored in the DoubleVector instance variable parameterSumsOfSquares with the parameters for factor A first, followed by the parameters for factor B and starting at the given index.
(Inherited from TwoWayAnovaBase.)
Protected methodMakeFactorParameters(Factor, DoubleVector, LinearRegression, Int32, Int32)
Create the array of AnovaRegressionFactorParam objects, one for each regression dummy variable. The sums of squares for each of these parameters is assumed to have been computed are are stored in the DoubleVector instance variable parameterSumsOfSquares with the parameters for factor A first, followed by the parameters for factor B and starting at the given index.
Protected methodMakeInteractionParameters
Creates the array of AnovaRegressionInteractionParam objects using the DoubleVector instance variable parameterSumsOfSquares_. The sums of squares for the interaction parameters are assumed to begin at the given index.
(Inherited from TwoWayAnovaBase.)
Protected methodReorderRegressionMatrix
For a give parameter order reorders the columns of the input regression matrix so that the the columns corresponding to the parameters are in the order specified by the parameter order.
Top
Fields
  NameDescription
Protected fieldanovaTable_
The ANOVA table.
Protected fieldcells_
The ANOVA data broken up into cells.
(Inherited from TwoWayAnovaBase.)
Protected fieldfactorA_
One of the factors in the ANOVA
(Inherited from TwoWayAnovaBase.)
Protected fieldfactorAparams_
Anovas for the factor A regression parameters.
Protected fieldfactorB_
The other factor in the ANOVA.
(Inherited from TwoWayAnovaBase.)
Protected fieldfactorBparams_
Anovas for the factor B regression parameters.
Protected fieldgrandMean_
The mean of all the data.
Protected fieldinteractionParams_
Anovas for the interaction regression parameters.
Protected fieldinterceptParameter_
Intercept parameter values for the ANOVA regression.
Protected fieldnumFactorAparams_
Number of regression parameters for factor A.
Protected fieldnumFactorBparams_
Number of regression parameters for factor B.
Protected fieldnumInteractionParams_
Number of interaction regression parameters.
Protected fieldobservations_
The observation vector for the regression used to compute the ANVOA.
(Inherited from TwoWayAnovaBase.)
Top
Remarks
We will use the notion described by Scholer. http://goanna.cs.rmit.edu.au/~fscholer/anova.php" What follows is an excerpt. Consider a model that includes two factors A and B; there are therefore two main effects, and an interaction, AB. The full model is represented by SS(A, B, AB). Other models are represented similarly: SS(A, B) indicates the model with no interaction, SS(B, AB) indicates the model that does not account for effects from factor A, and so on. It is convenient to define incremental sums of squares to represent these differences. Let SS(AB | A, B) = SS(A, B, AB) - SS(A, B) SS(A | B, AB) = SS(A, B, AB) - SS(B, AB) SS(B | A, AB) = SS(A, B, AB) - SS(A, AB) SS(A | B) = SS(A, B) - SS(B) SS(B | A) = SS(A, B) - SS(A) The notation shows the incremental differences in sums of squares, for example SS(AB | A, B) represents "the sum of squares for interaction after the main effects", and SS(A | B) is "the sum of squares for the A main effect after the B main effect and ignoring interactions"
See Also