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

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

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> 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 !

1 Like

I think you are just looking for a quantile,

quantile(d, 1 - α)
3 Likes

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

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

julia> quantile(d, 1 - 0.1)
9.29262634632168
1 Like

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.

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
1 Like