﻿ TwoWayAnova Class # TwoWayAnova Class

Two-way Analysis of Variance. Inheritance Hierarchy
SystemObject
Accord.Statistics.TestingTwoWayAnova

Namespace:  Accord.Statistics.Testing
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.8.0 Syntax
```[SerializableAttribute]
public class TwoWayAnova : IAnova```

The TwoWayAnova type exposes the following members. Constructors
NameDescription TwoWayAnova(Double, TwoWayAnovaModel)
Constructs a new TwoWayAnova. TwoWayAnova(Double, TwoWayAnovaModel)
Constructs a new TwoWayAnova. TwoWayAnova(Double, Int32, Int32, TwoWayAnovaModel)
Constructs a new TwoWayAnova.
Top Properties
NameDescription 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.
Top Methods
NameDescription 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.)
Top Extension Methods
NameDescription 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.) ToTOverloaded.
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.)
Top Remarks

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: Examples
```// 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``` See Also
{"ft_lang_label":"__label__en","ft_lang_prob":0.5910744,"math_prob":0.7795143,"size":5494,"snap":"2023-14-2023-23","text_gpt3_token_len":1396,"char_repetition_ratio":0.16794172,"word_repetition_ratio":0.13822284,"special_character_ratio":0.2803058,"punctuation_ratio":0.22185792,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9693809,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-03-29T16:18:26Z\",\"WARC-Record-ID\":\"<urn:uuid:c87c0f2d-048b-48a4-bc99-45f792d51c92>\",\"Content-Length\":\"33011\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ed95ac8d-0ac3-47ae-aee1-704639cb72dd>\",\"WARC-Concurrent-To\":\"<urn:uuid:1b2bb3ea-155d-4dd7-b5ad-f576401b1056>\",\"WARC-IP-Address\":\"192.30.252.153\",\"WARC-Target-URI\":\"http://accord-framework.net/docs/html/T_Accord_Statistics_Testing_TwoWayAnova.htm\",\"WARC-Payload-Digest\":\"sha1:IICVCPQ5TU64BPJIU2ER6X2DB24GVAKI\",\"WARC-Block-Digest\":\"sha1:NEHX2QZLGWNKLQE3TB3MH66VFVSAQXCQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296949009.11_warc_CC-MAIN-20230329151629-20230329181629-00728.warc.gz\"}"}