17.4.1.4 Algorithms (TwoWay ANOVA)TwoWayANOVAAlgorithm
Theory of TwoWay ANOVA
Let denotes the kth observation at level I of factor A and level j of factor B, the twoway ANOVA model can be rewritten as
where is the whole response data mean, is deviation at level I of factor A; is the deviation at level j of factor B, , is interaction term between two factors, and is the error term. Then the sample variation was divided into three part, so we can make three hypotheses test:
For factor A, the null hypothesis is that the means of the r different populations are the same, and the alternate hypothesis is at least one population’s mean is different from the others:
, for some p and q, 1 ≤ p, q ≥ r;
For factor B, the null hypothesis is that the means of the s different populations are the same, and the alternate hypothesis is at least one population’s mean is different from the others:
;
, for some p and q, 1 ≤ p, q ≥ s;
For the interaction term, the null hypothesis is that there is no interaction between the two factors:
;
, for some p and q, 1 ≤ p, q ≥ rs;
To test these hypotheses, Then partition the variance of the whole sample into four parts and estimate by the sample variation:
where
and we have
is the total sum of square, represents the variability of the average differences from factor A, represents the variability of the average differences from factor B, represents the variability of interaction, and represents the variability of all individual samples. Then, F test can be used to test the significance of variance between them, and we have:
Given a certain significance level , we can reject the null hypotheses if the F statistic exceeds the critical value , or equivalently, if the associated pvalue of the F statistic is less than the significance level , will be rejected.
The calculation of twoway ANOVA table is summarized as below:
Source of Variation

Degrees of Freedom (DF)

Sum of Squares (SS)

Mean Square (MS)

F Value

Prob > F

Factor A

r  1



/


Factor B

s  1



/


Interaction

(r 1) (s  1)



/


Error

rs (t  1)





Total

rst  1





Origin’s twoway analysis of variance makes use of several NAG functions. The NAG function nag_dummy_vars (g04eac) is used to create the necessary design matrices and the NAG function nag_regsn_mult_linear (g02dac) is used to perform the linear regressions of the design matrices. The results of the linear regressions are then used to construct the twoway ANOVA table. See the NAG documentation for more detailed information.
Multiple Means Comparisons
Given that a twoway ANOVA experiment has determined that at least one factor level mean is statistically different than the other factor level means of that factor, a means comparison subsequently compares all possible pairs of factor level means of that factor to determine which mean (or means) is ( or are ) significantly different. There are various methods for multiple means comparison in Origin, and we use the NAG function nag_anova_confid_interval (g04dbc)to perform means comparisons.
two types of multiple means comparison methods:
Singlestep method. It creates simultaneous confidence intervals to show how the means differ, including TukeyKramer, Bonferroni, DunnSidak, Fisher’s LSD, Scheffé, and Dunnett mothods.
Stepwise method. Sequentially perform the hypothesis tests, including HolmBonferroni and HolmSidak tests
Power Analysis
The power analysis procedure calculates the actual power for the sample data, as well as the hypothetical power if additional sample sizes are specified.
The power of a twoway analysis of variance is a measurement of its sensitivity. Power is the probability that the ANOVA will detect differences in the population means when real differences exist. In terms of the null and alternative hypotheses, power is the probability that the test statistic F will be extreme enough to reject the null hypothesis when it should be rejected actually (i.e. given the null hypothesis is not true).
The Origin TwoWay ANOVA dialog can compute powers for the Factor A and Factor B sources. If the Interactions check box is selected, Origin also can compute power for the Interaction source A*B.
Power is defined by the equation:
where f is the deviate from the noncentral Fdistribution with df and dfe degrees of freedom and nc = SS/MSE. SS is the sum of squares of the source A, B, or A*B, MSE is the mean square of the Errors, df is the degrees of freedom of the numerator for the source A, B, or A*B, dfe is the degrees of freedom of the Errors. All values (SS, MSE, df, and dfe) are obtained from the ANOVA table. The value of probf( ) is obtained using the NAG function nag_prob_non_central_f_dist (g01gdc)
. See the NAG documentation for more detailed information.
All the above is a brief algorithm outline of oneway analysis of variation, for more information about the detail mathematical deduction, please reference to the corresponding part of the user's manual and NAG document.
