TwoWayAnova Class |
Namespace: Accord.Statistics.Testing
The TwoWayAnova type exposes the following members.
Name | Description | |
---|---|---|
TwoWayAnova(Double, TwoWayAnovaModel) |
Constructs a new TwoWayAnova.
| |
TwoWayAnova(Double, TwoWayAnovaModel) |
Constructs a new TwoWayAnova.
| |
TwoWayAnova(Double, Int32, Int32, TwoWayAnovaModel) |
Constructs a new TwoWayAnova.
|
Name | Description | |
---|---|---|
FirstFactorSamples |
Gets the number of samples presenting the first factor.
| |
ModelType |
Gets or sets the type of the model.
| |
Observations |
Gets the number of observations in the sample.
| |
Replications |
Gets the number of replications of each factor.
| |
SecondFactorSamples |
Gets the number of samples presenting the second factor.
| |
Sources |
Gets or sets the variation sources obtained in the analysis.
| |
Table |
Gets the ANOVA results in the form of a table.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
The two-way ANOVA is an extension of the one-way ANOVA for two independent variables. There are three classes of models which can also be used in the analysis, each of which determining the interpretation of the independent variables in the analysis.
References:
// Example by J. Jones, Professor of Mathematics in Richland Community // College: https://people.richland.edu/james/lecture/m170/ch13-2wy.html // In this example, we collected the number of successfully grown corn plants // given the use of 4 types of fertilizer, and 3 different types of seed. double[,,] samples = { // Fert I Fert II Fert III Fert IV Fert V /* Seed A-402 */ { { 106, 110 }, { 95, 100 }, { 94, 107 }, { 103, 104 }, { 100, 102 } }, /* Seed B-894 */ { { 110, 112 }, { 98, 99 }, { 100, 101 }, { 108, 112 }, { 105, 107 } }, /* Seed C-952 */ { { 94, 97 }, { 86, 87 }, { 98, 99 }, { 99, 101 }, { 94, 98 } }, }; // There are always three hypothesis in a 2-way ANOVA: // - There is no difference between population means for the first factor; // - There is no difference between population means for the second factor; // - There is no interaction between the two different factors // Let's create a mixed-effect effects ANOVA model (ANOVA model 3) var twoWayAnova = new TwoWayAnova(samples, TwoWayAnovaModel.Mixed); // Now, we can obtain the test summary table by using: TwoWayAnovaVariationSources sources = twoWayAnova.Sources; // Seed source of variation double seedSS = sources.FactorA.SumOfSquares; // 512.86666666666713 double seedDF = sources.FactorA.DegreesOfFreedom; // 2 double seedMS = sources.FactorA.MeanSquares; // 256.43333333333356 double seedF = sources.FactorA.Statistic.Value; // 28.283088235294144 double seedPValue = sources.FactorA.Significance.PValue; // 8.1353422904297046E-06 double seedCrit = sources.FactorA.Significance.CriticalValue; // 3.6823203436732341 bool seedSignificant = sources.FactorA.Significance.Significant; // true // Fertilizer source of variation double fertilizerSS = sources.FactorB.SumOfSquares; // 449.46666666666607 double fertilizerDF = sources.FactorB.DegreesOfFreedom; // 4 double fertilizerMS = sources.FactorB.MeanSquares; // 112.36666666666652 double fertilizerF = sources.FactorB.Statistic.Value; // 12.39338235294116 double fertilizerPValue = sources.FactorB.Significance.PValue; // 0.00011887234971294213 double fertilizerCrit = sources.FactorB.Significance.CriticalValue; // 3.0555682759065936 bool fertilizerSignificant = sources.FactorB.Significance.Significant; // true // Interaction source of variation double interactionSS = sources.Interaction.SumOfSquares; // 143.1333333333335 double interactionDF = sources.Interaction.DegreesOfFreedom; // 8 double interactionMS = sources.Interaction.MeanSquares; // 17.891666666666687 double interactionF = sources.Interaction.Statistic.Value; // 1.9733455882352964 double interactionPValue = sources.Interaction.Significance.PValue; // 0.12208995001760085 double interactionCrit = sources.Interaction.Significance.CriticalValue; // 2.6407968829069017 bool interactionSignificant = sources.Interaction.Significance.Significant; // false // Within-variance source of variation double withinSS = sources.Error.SumOfSquares; // 136 double withinDF = sources.Error.DegreesOfFreedom; // 15 double withinMS = sources.Error.MeanSquares; // 9.0666666666666664