以非中心F分布在Excel中计算ANOVA检验效能与样本量
ANOVA Power Analysis Using Noncentral F-Distribution
独立研究者Prasanth Sambaraju提出一种在Microsoft Excel中用数组公式近似计算非中心F分布累积分布函数的方法,用于单因素ANOVA的检验效能与样本量估算。

https://stock.adobe.com
Analysis of variance (ANOVA) is a statistical test to compare means between groups, specifically by comparing between-group variance to within-group variance (1). A corresponding power analysis serves to determine the needed sample size to ensure reliable ANOVA results (2). Such evaluations often involve an F-distribution, which is characterized by use of two different degrees of freedom (υ1, υ2). In a sample with n observations and p variables (n > p), υ1 represents the number of variables minus 1 (p – 1), whereas υ2 represents the number of observations minus the number of variables (n – p). An F-distribution, along with its associated tests and critical values, is used in multivariate statistical process control, providing a basis upon which to detect outliers and assess whether an observation belongs to a predefined class (3).
Noncentral distributions are identified by an additional noncentrality parameter (λ) when compared to their respective central distributions. The noncentrality parameter measures the degree to which test statistics depart when the null hypothesis is false. Noncentral distributions are therefore used to calculate statistical power of a test when the null hypothesis is false (4).
Different approaches to estimating a cumulative distribution function (cdf) for a noncentral F-distribution using Microsoft Excel software can be found here (5–7). However, existing algorithms to compute cdf involve complex expansion and/or recurrence strategies. The method described herein does not involve any programming or application extensions while computing cdf values.
The noncentral cdf, F′, can be defined by Equation 1:
F′ = (χm2(λ) ÷ m) ÷ (χk2 ÷ k)
where χm2(λ) is the noncentral chi-squared distribution with m degrees of freedom, and χk2 is the noncentral chi-squared distribution with k degrees of freedom (8).
The noncentral chi-squared distribution, χm2(λ), can be further divided into a noncentral chi-squared distribution with 1 degree of freedom and a central chi-square distribution with (m – 1) degrees of freedom (9). The noncentral chi-square distribution with 1 degree of freedom is the squared normal distribution (8).
Equation 2: χm2(λ) = χ12(λ) + χm–12
Equation 3: χm2(λ) = (Z (λ0.5))2 + χm–12
In the case of the noncentral F-distribution, the F-distribution does not shift right or left as observed with noncentral t-distribution, but it stretches out to a different shape as shown in Figure 1 (6).

Figure 1: Comparison of central and noncentral F-distributions; the Microsoft Excel formula to compute the probability density function for a noncentral F-distribution (pdf-non) is given in reference 6.
Method
Noncentral F-distribution random variates were generated as described in Equations 1–3 above. Squared normal random numbers with a mean of λ0.5 and a standard deviation of 1 were generated in cells E2 to E25001. Chi-squared random numbers with (m – 1) degrees of freedom were generated in cells F2 to F25001. Cells G2 to G25001 correspond to the sum of cells in columns E and F divided by m. Cells H2 to H25001 correspond to chi-squared random numbers divided by k. The noncentral F-distribution random values are in column I, which presents the ratio of cells in columns G and H. The estimated cdf for a noncentral F-distribution is given in cell B7, which counts the number of values in column I2 to I25001 that are greater than the F-critical value (the threshold used to determine whether to reject the null hypothesis and thus whether findings are statistically significant). Figure 2 shows the formulas used for cdf estimation for the example described here (8).

Figure 2: The estimated cumulative distribution function (cdf) for the sample data is in agreement with the reported value (8). Because cdf estimates are obtained by simulation, variation in results can be observed upon recalculation. (lamba = noncentrality parameter, df = degrees of freedom, α = significance level, F-crit = F-critical value)
Noncentral F-Distribution cdf Using Microsoft Excel Software: The array formula to compute cdf in Excel software is given below:
=1-SUM((((0.5*Lambda)^(ROW($A$1:$A$101)-1))/FACT(ROW($A$1:$A$101)-1))*E^(-Lambda/2)*BETA.DIST((V_1*F)/(V_2+V_1*F),V_1/2+ROW($A$1:$A$101)-1,V_2/2,TRUE))
Table 1 describes built-in Excel functions used in the array formula. The formula approximates cdf estimate by dividing the area under the curve into 100 slices (ROW($A$1:$A$101)-1), and then the area of each slice is added to compute the cdf. The power of an ANOVA F-test is obtained by subtracting the cdf value from 1, considering that it returns the area under the curve to the right of the F-critical value (6). One limitation of this formula is that the number of slices cannot exceed 170 because the Excel program cannot output factorials for greater numbers.

Table 1: Description of terms in cumulative distribution function (cdf) calculation using a Microsoft Excel array formula (6)
Power of ANOVA Using Noncentral F-distribution: ANOVA uses F-tests to test statistically for the equality of means. The F-statistic represents the ratio of two variances, providing a measure of how far data are scattered from the mean. In the case of a one-factor ANOVA, the ratio of group variability to within-group variability follows an F-distribution when the null hypothesis is true (10). Assumptions for one-factor ANOVAs are discussed in Navarro (11), and Laverty and Kelly describe the effects of violating those assumptions (12). Herein, hypothetical data comparing four different methods (5) are used to compute the power of an ANOVA using a noncentral F-distribution. Table 2 compares the power obtained with λ values from different procedures (5, 13, 14).

Table 2: Power estimation for one-factor analysis of variance (ANOVA); λ = noncentrality parameter
Figure 3 shows results from a one-factor ANOVA. The p-value obtained (≈0.045) was <0.05, indicating a statistically significant difference across the four methods. The power required for statistical tests is typically set to 80% according to an arbitrary convention (15). But because the power obtained is <80% irrespective of the method used to estimate the noncentrality parameter, the experiment needs to be conducted with a larger sample size to reach a definitive conclusion.

Figure 3: Comparison of noncentrality parameter (ncp, λ) estimation; the value shown in cell B21 is based on the method described in reference 13, whereas the value in cell B22 was calculated as the ratio of sum of squares between groups to the mean square error (5). (ANOVA = analysis of variance, df = degrees of freedom, F-crit = F-critical value, k = degrees of freedom, m = degrees of freedom, MS = mean of squares, ni = number of observations in each method, omega = elementary event, p-value = probability value, Plus @@ni = sum of the ni values, sd = standard deviation, SS = sum of squares)
Therein, η2 provides a measure of the effect size, or the proportion of variance in the dependent variable that is explained by the independent variables. Specifically, η2 calculates the ratio of between-group variance (written as the sum of squares between groups, SSbetween) to the total variance in the data (written as the total sum of squares, SStotal). In Figure 3, η2 was computed using Equations 4–6 as described in reference 16, and λ was estimated as described in reference 14:
Equation 4: η2 = SSbetween ÷ SStotal
Equation 5: f(effect size) = (η2 ÷ (η2 – 1))0.5
Equation 6: λ = nf2 (where n = sample number)
Figure 4 shows λ and power calculation using G*Power software (Heinrich-Heine-Universität Düsseldorf) (17).

Figure 4: Calculation of noncentrality parameter (λ) and analysis of variance (ANOVA) power using G*Power software (16) (α = significance level, β = probability of making a type II error, df = degrees of freedom)
Sample-Size Calculation: Sample-size estimation for statistical tests is an important aspect of analysis. It depends on number of groups, effect size, number of effect levels, type 1 error, and power. Effect size in ANOVA corresponds to the difference between the means of the lowest and highest groups divided by the common standard deviation. Özge and Serpil discuss the use of simulations to calculate the optimal sample size required for an ANOVA (18).
Zaiontz describes sample-size calculation using Microsoft Excel software for a given effect size (5). ANOVA power can be computed if sample size and effect size are given. Herein, power was calculated for a one-factor ANOVA using the method described in reference 14 to compare the effects of three drugs on blood pressure for a range of sample sizes and error variances. As Figure 5 shows, for a given value of error variance, power increases with sample size. Power is also higher for smaller error-variance values (19).

Figure 5: The estimated power for a range of sample sizes and error variances (Err var, 35 and 60) using the Data Table function in Microsoft Excel software; the noncentrality parameter, lambda (λ), was estimated using the method described in 14. (α = significance level, df = degrees of freedom)
One-factor ANOVA was performed after including an additional row of data in the hypothetical data as shown in Figure 6. The p-value obtained (0.0126) was <0.05. That indicates a statistically significant difference across the four methods. The power obtained is >80%. In this case, ANOVA could have detected a true effect.

Figure 6: Power estimation after inclusion of additional data; λ was calculated using the method described in 5. (ANOVA = analysis of variance, df = degrees of freedom, F-crit = F-critical value, MS = mean of squares, p-value = probability value, and SS = sum of squares)
Related ANOVA Applications
Jain and Jain describe their use of ANOVA and noncentral F-distributions in optimizing a temozolomide product formulated with both polyethylene-glycol–conjugated (PEGylated) and non-PEGylated nanoparticles (20). The study assessed drug concentration, concentration of poly(lactic-co-glycolic) acid (PLGA)/PEG–PLGA, concentration of polyvinyl alcohol (PVA) in the aqueous phase, and sonication time as independent variables. The dependent variables assessed were percentage of drug entrapment and particle size. The study helped to predict the values of independent variables for optimal preparation of nanoparticles with desired properties (20).
Takács describes use of ANOVA in a clinical comparability study between RGB-10 (a biosimilar teriparatide) and the reference teriparatide product (21). Statistical analysis was performed after log transformation of the pharmacokinetic parameters.
Conclusion
Existing methods for computing cdf values are complicated. The method presented herein provides a strategy that is easy to understand and can be readily implemented without the need for complex code.
Supporting Materials
The following Microsoft Excel files are available for download:
• plot comparing central and noncentral F-distributions
• noncentral F-distribution cdf estimation
• example of ANOVA power estimation.
References
1 Kim H-Y. Analysis of Variance (ANOVA) Comparing Means of More Than Two Groups. Restor. Dent. Endod. 39(1) 2014: 74–77; https://doi.org/10.5395/rde.2014.39.1.74.
2 Kang H. Sample Size Determination and Power Analysis Using the G*Power Software. J. Edu. Eval. Health Prof. 18, 2021: 17; https://doi.org/10.3352/jeehp.2021.18.17.
3 Brereton RG. The F Distribution and Its Relationship to the Chi Squared and t Distributions. J. Chemomet. 29, 2015: 582–586; https://doi.org/10.1002/cem.2734.
4 Sambaraju P. Computation of Cumulative Density of Noncentral Chi-Square Distribution in Excel. Quantit. Meth. Psychol. 18(3) 2022: 255–257; https://doi.org/10.20982/tqmp.18.3.p255.
5 Zaiontz C. Power for One-Way ANOVA. Real Statistics Using Excel 2026; https://real-statistics.com/one-way-analysis-of-variance-anova/power-for-one-way-anova.
6 Calberg C. Statistical Analysis: Microsoft Excel 2013. Pearson Education: London, UK, 2014.
7 Byron NJ. A Robust Function To Return the Cumulative Density of Non-Central F Distributions in Microsoft Office Excel. Psicológica 37(1) 2016: 61–83; https://files.eric.ed.gov/fulltext/EJ1090072.pdf.
8 Liu XS. A Unified Way To Represent and Compute the Cumulative Distribution Function for Noncentral t, F, and χ2. Comm. Stat. Simul. Comput. 42(6) 2013: 1433–1436; https://doi.org/10.1080/03610918.2012.664230.
9 Norman LJ, Samuel K, Balakrishnan N. Continuous Univariate Distributions (2nd ed.) Wiley: New York, NY, 1995.
10 Understanding Analysis of Variance (ANOVA) and the F-Test. Minitab 18 May 2016; https://blog.minitab.com/en/blog/adventures-in-statistics-2/understanding-analysis-of-variance-anova-and-the-f-test.
11 Navarro D. Assumptions of One-Way ANOVA. Learning Statistics with R: A Tutorial for Psychology Students and Other Beginners. LibreTexts Statistics: Davis, CA, 2024; https://stats.libretexts.org/Bookshelves/Applied_Statistics/Learning_Statistics_with_R_-_A_tutorial_for_Psychology_Students_and_other_Beginners_(Navarro).
12 Laverty W, Kelly I. Using Excel To Explore the Effects of Assumption Violations on One-Way Analysis of Variance (ANOVA) Statistical Procedures. Open J. Stat. 9(4) 2019: 458–469; https://doi.org/10.4236/ojs.2019.94031.
13 Hélie S. Understanding Statistical Power Using Noncentral Probability Distributions: Chi‐Squared, G‐Squared, and ANOVA. Quantit. Meth. Psychol. 3(2) 2007: 63–69; http://dx.doi.org/10.20982/tqmp.03.2.p063.
14 One-Way Analysis of Variance F-Tests Using Effect Size. NCSS: Kaysville, UT, 2026; https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/PASS/One-Way_Analysis_of_Variance_F-Tests_using_Effect_Size.pdf.
15 Columb MO, Atkinson MS. Statistical Analysis: Sample Size and Power Estimations. BJA Edu. 16(5) 2016: 159–161; https://doi.org/10.1093/bjaed/mkv034.
16 Volchok E. Chapter 16: One-Way ANOVA Tests. Clear-Sighted Statistics. CUNY Manifold: New York, NY, 2020; https://cuny.manifoldapp.org/read/chapter16_one-wayanovar1/section/4ba8b104-7a1c-4e85-8ea6-b2fcc9d51ab0.
17 Faul F, et al. G*Power: Statistical Power Analyses for Mac and Windows. Heinrich-Heine-Universität Düsseldorf: Düsseldorf, Germany, 2026; https://www.psychologie.hhu.de/arbeitsgruppen/allgemeine-psychologie-und-arbeitspsychologie/gpower.
18 Özge KA, Serpil AA. Optimal Sample Size Determination for the ANOVA Designs. Int. J. Appl. Math. Stat. 25(1) 2011: 127–134; https://www.researchgate.net/publication/282242860_Optimal_Sample_Size_Determination_for_the_ANOVA_Designs.
19 Power Analysis for ANOVA Models. StataCorp: College Station, TX, 2026; https://www.stata.com/features/overview/power-analysis-for-anova-models.
20 Jain A, Jain SK. Formulation and Optimization of Temozolomide Nanoparticles by 3 Factor 2 Level Factorial Design. Biomatter 3(2) 2013: e25102; https://doi.org/10.4161/biom.25102.
21 Takács I, et al. The First Biosimilar Approved for the Treatment of Osteoporosis: Results of a Comparative Pharmacokinetic/Pharmacodynamic Study. Osteoporos. Int. 30, 2019: 675–683; https://doi.org/10.1007/s00198-018-4741-0.
Prasanth Sambaraju, MS (pharmacy), MS (chemistry), is an independent researcher focusing on applications for computational techniques within the pharmaceutical industry; [email protected].
Please cite this article as Sambaraju P. ANOVA Power Analysis Using Noncentral F-Distribution. BioProcess Int. 24(9) 2026: 240907.
来源:BioProcess International · 工艺与质量 · bioprocessintl.com