To compare the price of a certain product in two cities, ten shops were selected random in each city. The following observations were obtained:Â
City A: 61 63 56 63 56 62 59 60 61 65
City B: 55 54 47 59 51 61 57 54 64 58Â
Test whether the average price can be said to be the same in the two cities (5% level of significance).Â
"H_0: \\mu_1=\\mu_2 \\\\\nH_1: \\mu_1\u2260 \\mu_2"
Using R
Let’s test date for normality using shapiro.test(). Since these two samples are independent we need to test them individually. Here are just the p-values from the normality test.
The samples appear to be normally distributed so we may proceed with a standard t-test. The t-test also assumes that the variances are equal.
Let’s test that, too, using the var.test( ) variance test.
The resulting p-value (p = 0.1437) suggests that we should not reject the H0 (variances are not different). Therefore, we should conduct a t-test.
Since P_{cal}=0.02075 < P = 0.05
Reject H0.
There is enough evidence to conclude that the average price can NOT be said to be the same in the two cities (5% level of significance).
Comments
Leave a comment