# How to obtain the critical value F0 of a F-distribution?

**URL:** <https://discourse.julialang.org/t/how-to-obtain-the-critical-value-f0-of-a-f-distribution/36448>\
**Category:** Statistics\
**Tags:** f-distribution\
**Created:** [March 24, 2020, 2:05pm UTC](https://discourse.julialang.org/t/how-to-obtain-the-critical-value-f0-of-a-f-distribution/36448 "2020-03-24T14:05:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fred](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fred/32/14175_2.png) [@Fred](https://discourse.julialang.org/u/Fred)\
**Post date:** [March 24, 2020, 2:05pm UTC](https://discourse.julialang.org/t/how-to-obtain-the-critical-value-f0-of-a-f-distribution/36448/1 "2020-03-24T14:05:47Z")

</div>

Hi,  
I am not statistician and I need some advises to do a statistical test in Julia. I would like to obtain the critical value F0 of a F-distribution available for example in these tables

> **[F-Distribution Tables](http://socr.ucla.edu/Applets.dir/F_Table.html)**
>
> Statistics Online Computational Resource

I read the Distributions.jl documentation, I found that it is possible to build a F-distribution, for example, with 5 and 2 degree of freedom

```julia

julia> using Distributions
 julia> d = FDist(5,2)
FDist{Float64}(ν1=5.0, ν2=2.0)

```

The risk F0, for 5 and 2 degree of freedom in the F Table for α = 0.10 is F0 = 9.29263. But I did not managed to obtain this value because I didn’t find how to obtain the critical value in the documentation. Maybe there is another word to call this parameter… Is it possible ? Thank you for your help !

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 24, 2020, 2:38pm UTC](https://discourse.julialang.org/t/how-to-obtain-the-critical-value-f0-of-a-f-distribution/36448/2 "2020-03-24T14:38:41Z")

</div>

I think you are just looking for a quantile,

```julia
quantile(d, 1 - α)

```

---

<div class="post-metadata">

**Author:** ![Fred](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fred/32/14175_2.png) [@Fred](https://discourse.julialang.org/u/Fred)\
**Post date:** [March 24, 2020, 2:42pm UTC](https://discourse.julialang.org/t/how-to-obtain-the-critical-value-f0-of-a-f-distribution/36448/3 "2020-03-24T14:42:44Z")

</div>

> [@Tamas\_Papp](#):
>
> quantile(d, 1 - α)

@Tamas_Papp, Exactly !!! I can reproduce all the values of the tables with the quantile. Thank you very much !

```julia
julia> d
FDist{Float64}(ν1=5.0, ν2=2.0)

julia> quantile(d, 1 - 0.1)
9.29262634632168

```

---

<div class="post-metadata">

**Author:** ![evandrojr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evandrojr/32/25488_2.png) [@evandrojr](https://discourse.julialang.org/u/evandrojr)\
**Post date:** [May 26, 2021, 12:16pm UTC](https://discourse.julialang.org/t/how-to-obtain-the-critical-value-f0-of-a-f-distribution/36448/4 "2021-05-26T12:16:50Z")

</div>

> [@Tamas\_Papp](#):
>
> `quantile(d, 1 - α)`

Hi @Fred, I am using this method to test 2 variances using the F-distribution. It is not the most efficient but is very easy to read and understand. Thank you guys. Without your help I wouldn’t be able to figure it out all that by myself. Keep sharing your knowledge! Thanks.

```julia
testStatisticsTwoVariances(s²1, s²2) = s²1 / s²2 

# The shape is always two-tailed
# Returns: 1 if homoscedastic 
# 2 if heteroscedastic
function FHypothesisTest2Variances(s²1, s²2, n1, n2, α)
    F = testStatisticsTwoVariances(s²1, s²2)
    dl = FDist(n2 - 1, n1 - 1)
    ql = quantile(dl, 1 - α/2)
    Fl = 1 / ql
    dr = FDist(n1 - 1, n2 - 1) 
    qr = quantile(dr, 1 - α/2)
    Fr = qr 

    println("Fl $Fl F $F Fr $Fr α $α")
    if ( Fl <= F <= Fr)
        println("Accept H0. Homoscedastic")
        return 1
    else
        println("Refute H0. Heteroscedastic")
        return 2
    end        
     
end

```
