Erdogan CEVHER
Erdogan CEVHER

Reputation: 1609

How to find F value that corresponds to a specific p value, e.g. p=0.05 in R?

I want to find the F value (of a one(right)-tailed distribution) that will correspond to p=0.05 given pre-specified two degrees of freedom (1 and 29 below). I do this by trial and error:

#..F values..............p values...
1-pf(4.75, 1, 29)    # 0.03756451
1-pf(4.15, 1, 29)    # 0.05085273
1-pf(4.18295, 1, 29) # 0.05000037
1-pf(4.18297, 1, 29) # 0.04999985
1-pf(4.18296, 1, 29) # 0.05000011

So, I want to obtain F=4.18296 without trial and error. Any idea?

Upvotes: 0

Views: 266

Answers (1)

etienne
etienne

Reputation: 3678

There are two possibilities to achieve such result, we need to use the quantile function:

qf(1 - 0.05, 1, 29) or qf(0.05, 1, 29, lower.tail = FALSE)

qf(1 - 0.05, 1, 29)
# [1] 4.182964

qf(0.05, 1, 29, lower.tail = FALSE)
# [1] 4.182964

1 - pf(4.182964, 1, 29)
# [1] 0.05000001

The first option takes into account that the default option of lower.tail is equal to TRUE so we have to use 1 - 0.05

For the second option, we specify that we want P[X > x] using lower.tail = FALSE

Upvotes: 3

Related Questions