1
$\begingroup$

Here is the problem: Suppose you analyze potato prices in Brno and Prague. For Brno you analyze 18 shops and find sample variance 45. For Prague you analyze 27 shops and find sample variance 75. Test the equality of price variances using the 5% significance level.

  1. First, as this is two tailed test, the regions of rejection on either side should be equal to $\alpha / 2 = 0.025$. Then for null hypothesis to be rejected, the test statistic $F = \frac{s_1^2}{s^2_2} = \frac{45}{75} = 0.6$ should be less than $F_{1-\alpha/2, \nu_1, \nu_2}$ or greater than $F_{\alpha/2, \nu_1, \nu_2}$. $F_{1-\alpha/2, \nu_1, \nu_2} = 0.396$ and $F_{\alpha/2, \nu_1, \nu_2} = 2.313. $ So, with confidence interval $\alpha = 5% $ we cannot reject the hypothesis, that the price variances are not equal.

The p-value given for the ratio and given $\nu_1 , \nu_2$ is equal to $0.863 < 0.95~~\Longrightarrow~~H_0~$ cannot be rejected. But is there a way to find p-value from tables? Also, how to know how to graph the given F distribution ?

$\endgroup$

3 Answers 3

1
$\begingroup$

Finding the p-value for a two-tailed test can be confusing. Some Intro to Statistics textbooks say to double the p-value and compare it to alpha, while other texts say to us the p-value as-is and compare it to half-alpha. Either method will provide the same results, but any discussion of the findings that included the p-value should indicate which method was used.

$\endgroup$
2
  • $\begingroup$ Welcome to CV. There are two questions: (1) "is there a way to find p-value from tables?" and "how to know how to graph the given F distribution?" It would be nice if your answer addressed at least one of them explicitly. For more about how things work here, please see our help center. $\endgroup$
    – whuber
    Jan 8, 2023 at 21:24
  • $\begingroup$ My apologies. I was attempting to address an issue involving the p-value in a two-tailed test, regardless of the source (table or software) of the p-value. I will try to stick to the topic in the future. $\endgroup$ Jan 10, 2023 at 20:46
0
$\begingroup$

Your calculations are nearly correct (The accurate critical values should be $0.394$ and $2.335$), and your inference is also correct. I'm not sure if I understand your question properly of not, but anyway, I presume that you're asking how can you plot the density of $F_{\nu_1 , \nu_2}$ distribution, and how to find p-value from an F-table.


For given values of $\nu_1$ and $\nu_2$ , and $x \in [0 , \infty)$ , the random variable $X \sim F_{\nu_1 , \nu_2}$ distribution has a density function : $$f_X(x) = \frac{1}{B(\nu_1,\nu_2)}\cdot \dfrac{\left(\frac{\nu_1}{\nu_2}\right)^{\frac{\nu_1}{2}} x^{\frac{\nu_1}{2} - 1}}{\left[\left(\frac{\nu_1}{\nu_2}\right)x + 1 \right]^\frac{\nu_1+\nu_2}{2} }$$ As you can see, the density of $X$ looks quite horrendous, and it's nearly impossible to figure out manually how the density actually looks like. The best way to plot the density is to use either some graphing calculator (e.g. Desmos, Geogebra) or programming languages (e.g. R, Python, MATLAB).


Now, let us talk about your question regarding p-value. The way you asked it is telling me that your understanding of p-value may be a little bit problematic. Remember that on the basis of an observation $c$ (Here, $c=0.6$) , the p-value is the probability that the random variable takes value "at least as extreme as $c$" . So, here it's nothing but : $$P(X \geqslant 0.6) = 1 - P(X \leqslant 0.6) = 1 - 0.138 = 0.862$$ So basically, from the table you'll have to check the value of $P(X \leqslant 0.6)$ which should be readily available in the F-table. However, for more precision, you may use R or Python. For example, in R, you may write :

install.packages("VaRES")
library(VaRES)
pf(0.6 , df1 = 17 , df2=26 , lower.tail = FALSE)

This'll give you the p-value, and hence you'll be able to infer whether to accept or reject $H_0$ .

$\endgroup$
3
  • 1
    $\begingroup$ Why $X \ge 0.6$ instead of $\le 0.6$? $\endgroup$
    – user
    Nov 29, 2020 at 0:30
  • $\begingroup$ You should adjust your P-value for a 2-sided test. $\endgroup$
    – BruceET
    Nov 29, 2020 at 1:30
  • 1
    $\begingroup$ pf(q, df1, df2, ncp, lower.tail = TRUE, log.p = FALSE) is also in Base R. Like @user I am not sure why you used lower.tail=FALSE rather than lower.tail=TRUE and then double it for a two-sided test $\endgroup$
    – Henry
    Nov 29, 2020 at 2:04
0
$\begingroup$

Output for an F test from a recent release of Minitab is shown below. The desired test is shown after various 95% confidence intervals. The P-value $0.277 > 0.05,$ so there is no significant difference between the sample means (i.e., the null hypothesis the population means are the same is not rejected). This F-test assumes the data are normal.

[Also notice that the 95% CI for the ratio of variances $(0.257, 1.523)$ includes $1,$ which also suggests no significant difference.]

Test and CI for Two Variances   

Null hypothesis         σ(First) / σ(Second) = 1
Alternative hypothesis  σ(First) / σ(Second) ≠ 1
Significance level      α = 0.05

F method was used. This method is accurate for normal data only.


Statistics

                                95% CI for
Sample   N  StDev  Variance       StDevs
First   18  6.708    45.000  (5.034, 10.057)
Second  27  8.660    75.000  (6.820, 11.868)

Ratio of standard deviations = 0.775
Ratio of variances = 0.600


95% Confidence Intervals

                            CI for
         CI for StDev      Variance
Method       Ratio           Ratio
F       (0.507, 1.234)  (0.257, 1.523)


Tests

                       Test
Method  DF1  DF2  Statistic  P-Value
F        17   26       0.60    0.277

Notes: (1) There is a var.test procedure in (the base of) R, but it requires the actual data values from the two cities.


Addendum per comments: Here is simulated data and a two-sided P-value corresponding to the data.

Simulate data:

set.seed(2020)
x1 = rnorm(18, 50, 6.5);  x2 = rnorm(27, 55, 8.5)
summary(x1);  length(x1);  var(x1)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  30.25   45.24   51.36   50.07   56.06   61.70 
[1] 18          # sample size
[1] 83.54155    # sample variance
summary(x2);  length(x2);  var(x2)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  35.54   51.57   55.94   56.59   62.41   75.70 
[1] 27
[1] 72.09251

Perform 2-sided F-test:

var.test(x1, x2)

        F test to compare two variances

data:  x1 and x2
F = 1.1588, num df = 17, denom df = 26, p-value = 0.7168
alternative hypothesis: 
  true ratio of variances is not equal to 1
95 percent confidence interval:
 0.4961768 2.9408585
sample estimates:
ratio of variances 
           1.15881 

# Illustrate computation of P-value
1 - pf(1.1588, 17, 26)
[1] 0.3584039
pf(1/1.1588, 26, 17)
[1] 0.3584039
2*(1 - pf(1.1588, 17, 26))
[1] 0.7168078

Figure:

Graph showing density function of $\mathsf{F}(\nu_1 = 17, \nu_2 = 26).$ P-value of test is area beneath the curve outside the two vertical black bars. [The position of the vertical dotted bar is only approximate (on account of unequal sample sizes).]

enter image description here

# R code for figure
curve(df(x, 17, 26), 0, 5, lwe=2, col="blue", 
        ylab="Density", main="F(17, 26)")
 abline(h=0, col="green2");  abline(v=0, col="green2")
 abline(v = 1.1588)
 abline(v = 1/1.1588, lty="dotted")
$\endgroup$
2
  • $\begingroup$ You got different p value than that of the other poster. When using online calculator for p-value for F statistic, I obtained the same result as him. $\endgroup$
    – user
    Nov 29, 2020 at 0:58
  • $\begingroup$ Apparently, both of you found the P-value for a one-sided test. Your problem clearly states at the start that you should do a two-sided test. The other answer has the value $0.138,$ which doubled for a two-sided test gives essential the same as Minitab P-value $0.277.$ The P-value is the probability of a more extreme value than shown by the t stat in the direction(s) of the alternative hypothesis. // Exact P-values can't generally be found from printed tables--software required. // P-value 0.138 and 0.862 are incorrect for the problem you ask. (One reason for taking time to answer.) $\endgroup$
    – BruceET
    Nov 29, 2020 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.