classic stat tests Flashcards
Hypothesis test for comparing the variances of two samples
f-test
## F = 28.517, num df = 5, denom df = 4, p-value = 0.003169
## alternative hypothesis: true ratio of variances is greater than 1
## 95 percent confidence interval:
## 4.558378 Inf
## sample estimates:
## ratio of variances
## 28.51747
How can we interpret the R output?
It returns the following:
the value of the F test statistic.
the degrees of freedom of the F distribution of the test statistic.
the p-value of the test is 0.2105
95% confidence interval for the ratio of the population variances.
the ratio of the sample variances is 2.4081
The p-value of the F-test is p = 0.003169 which is lower than the alpha level of 0.05. In conclusion, there is a difference between the two samples.
hypothesis test for a single mean
t-test
One Sample t-test
## data: type_A
## t = -0.64336, df = 5, p-value = 0.5483
## alternative hypothesis: true mean is not equal to 70
## 95 percent confidence interval:
## 28.37016 94.96317
## sample estimates:
## mean of x
## 61.66667
How can we interpret the R output?
p-value: The two-tailed p-value that corresponds to a t test-statistic of -0.64336 and 5 degrees of freedom.
The null and alternative hypotheses for this one sample t-test are as follows:
H0: µ = 70 (the mean is 70)
HA: µ ≠ 70 (the mean is not 70)
Because the p-value of our test (0.5483) is greater than 0.05, we fail to reject the null hypothesis of the test.
how to compare two means of the two groups.
two sample t-test
what assumptions are made in two sample t-test
- The two groups are independent;
- The observations within each group are independent;
- The variance of the measurements within each group are similar;
- The observations from each of the groups are normally distributed.
Welch Two Sample t-test
##
## data: type_A and type_B
## t = -0.82687, df = 5.4177, p-value = 0.4432
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -44.14995 22.28328
## sample estimates:
## mean of x mean of y
## 61.66667 72.60000**
Question How can we interpret the R output?
t: This is the t test-statistic.
The two hypotheses for this particular two sample t-test are as follows:
H0: µ1 = µ2 (the two population means are equal)
HA: µ1 ≠µ2 (the two population means are not equal)
Because the p-value of our test (0.4432) is more than alpha = 0.05, we accept the null hypothesis of the test.
The Mann-Whitney U test (Wilcoxon rank-sum test)
test is used as a substitution for the unpaired t-test, when the assumptions of normality fail to be satisfied.
what does the Mann-Whitney U test (Wilcoxon rank-sum test) compare
the median values in the two groups and not the mean like the t-test.
what assumption is made in the Mann-Whitney U test (Wilcoxon rank-sum test)
the data can be ranked. Instead of using the observations, we use their ranking.
However, if the data is normally distributed using the Mann-Whitney test would be less powerful than using the t-test for small samples.
Wilcoxon rank sum exact test
##
## data: type_A and type_B
## W = 13, p-value = 0.7922
## alternative hypothesis: true location shift is not equal to 0
Question How can we interpret the R output?
p-value of 0.7922 and the significance value we chose is 0.05, then there
is no evidence to reject the null hypothesis.
comparing two dependent means
paired t-test
Paired t-test
##
## data: group1 and group2
## t = 1.633, df = 4, p-value = 0.0889
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -0.6109684 Inf
## sample estimates:
## mean of the differences
## 2
- How do we interpret the R output?
p value is greater than 0.05; accept the null hypothesis
what assumptions are made in paried t-test
- Independence: Each observation should be independent of every other observation.
- Normality: The differences between the pairs should be approximately normally distributed.
- No Extreme Outliers: There should be no extreme outliers in the differences.
what test is applied to matched or dependent samples
The Wilcoxon matched pairs test (Wilcoxon signed rank
test)