While the F distribution characterizes how the F test statistic is distributed when the null hypothesis is assumed to be true, the noncentral F distribution instead shows how the F test statistic is distributed when the alternative hypothesis is assumed to be true (i.e. when the null hypothesis is assumed to be false). As such it is useful in calculating the power of the usual F tests (ANOVA, regression, etc.).

**Definition 1**: The **noncentral F distribution**, abbreviated as *F*(*k*_{1}, *k*_{2}, *λ*) has the cumulative distribution function *F*(*x*), written as *F*_{k1,k2,λ}(*x*) when necessary, where *k*_{1}, *k*_{2 } = the degrees of freedom and non-negative *λ* = the noncentrality parameter.

when *x* ≥ 0, where *I _{r}*(

*a,b*) is the distribution function of the beta distribution

*I _{q}*(

*a,b*) = BETADIST(

*q, a, b*)

When *x* < 0, the noncentral F distribution is *F*(*x*) = 0.

**Observation**: The probability density function (pdf) of the noncentral F distribution can be calculated as follows:

where *B*(*a, b*) is the beta function

and Γ(*k*) is the gamma function. *B*(*a, b*) can be calculated in Excel by the formula

=EXP(GAMMALN(*a*)+GAMMALN(*b*)−GAMMALN(*a + b*))

**Real Statistics Functions**: The following functions are provided in the Real Statistics Pack:

**NF_DIST**(*x, df*1*, df*2

*). If*

*,*λ, cum, m, prec*cum*= TRUE then the value of the noncentral F distribution

*F*(

*df*1,

*df*2,

*λ*) at

*x*is returned, while if

*cum*= FALSE then the value of the pdf at

*x*is returned.

**NF_INV**(p*, df*1*, df*2

*) = the inverse of the cdf of the noncentral F distribution*

*,*λ, m, iter, prec*F*(

*df*1,

*df*2,

*λ*) at

*p*, i.e. the value of

*x*such that NF_DIST(

*x, df*1

*,*2

*df**TRUE*

*,*λ,*, m, prec*) =

*p*.

**NF_NCP**(*p, df*1*, df*2

*) = the value of the noncentrality parameter*

*, x*, m, iter, prec*λ*such the cdf of the noncentral F distribution

*F*(

*df*1,

*df*2,

*λ*) at

*x*is

*p*, i.e. NF_DIST(

*x, df*1

*,*2

*df**TRUE*

*,*λ,*, m, prec*) =

*p*.

**BETA**(*x*, y) = beta function at *x*, y

Here *m* = the upper limit in the infinite sum (default 1,000) and *iter* = the number of iterations used to calculate NF_INV or NF_NCP (default 40). Also the calculation of the infinite sum for the noncentral F distribution stops when the level of precision exceeds *prec* (default 0.000000001).

**Observation**: The following chart shows the graphs of the noncentral F distribution with 5, 10 degrees of freedom for *λ* = 0, 1, 5, 10, 20. Note that when *λ* = 0, the distribution is the central F distribution, i.e. *F*(*k*_{1}, *k*_{2}, 0) = *F*(*k*_{1}, *k*_{2}).

**Figure 1 – Noncentral F pdf by noncentrality parameter**

Hi, How are you doing?

I am looking for VBA code of the cumulative distribution function (CDF) for the noncentral F-distribution, but I have not found.

Do you have one?

Could you help me?.

Thanks so much.

Karol

Karol,

The algorithm is pretty much described on the referenced webpage. If you know VBA it shouldn’t hard to implement.

Charles

Thanks so much!

I am looking for type error II probability, so I think that I have to use NF_NCP Function, but I have only the tree input as

df1, df2, FI and Noncentrality parameter (λ).

What does p, df1, df2, x, m, iter means?

Sorry for my lack of knowledge.

Could you help me to understand a little more

thanks so much.

Karol

Karol,

These parameters are defined on the referenced webpage, but let me give you an example using the NF_NCP function, more specifically formulas of form NF_NCP(p, df1, df2, x, m, iter), which calculate the value of the noncentrality parameter lambda λ.

p = the significance level, usually referred to as alpha; most commonly p takes the value .05

df1, df2 = degrees of freedom; in fact in the standard Excel formula F.INV(p,df1, df2) for the inverse of the F distribution, the p, df1 and df2 are the same as those in the noncentrality F distribution.

x = the value of the F statistic; in fact this the same value of x that is used in the standard Excel formula F.DIST(x, df1, df2, cum) for the F distribution.

m = the upper limit in the infinite sum (1 – 170, default 40); don’t worry about this parameter, just use the default value.

iter = the number of iterations used to calculate NF_INV or NF_NCP (default 40); don’t worry about this parameter, just use the default value.

Charles

One more time, thanks so much,

Now I could understand how that function work.

Thanks for your time.

Karol

Hi,

Please, can you tell me if is possible to use RealStats Add-in in VBA.

I want to run the RealStats Add-In Function in VBA. Is it possible?

Thanks

Karol

Karol,

Yes you can call Real Statistics functions in VBA as described on the webpage http://www.real-statistics.com/excel-capabilities/calling-real-statistics-functions-in-vba/.

Charles

Hi

Work well,

thanks,

Karol