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)
Wilcoxon signed rank test with continuity correction
##
## data: group_1 and group_2
## V = 15, p-value = 0.05791
## alternative hypothesis: true location shift is not equal to 0
How do we interpret the R output?
p value is greater than 0.05; accept the null hypothesis
A binomial test
when an experiment has two possible outcomes (i.e. success/failure) and you have an idea about what the probability of success is. A binomial test is run to see if observed test results differ from what was expected.
##
## data: 90 and 200
## number of successes = 90, number of trials = 200, p-value = 0.179
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
## 0.3797536 0.5217507
## sample estimates:
## probability of success
## 0.45
The p-value of the test is 0.179. Since this is greater than 0.05, we can accept the null hypothesis
Assumptions for the Binomial Test
Items are dichotomous (i.e. there are two of them) and nominal.
The sample size is significantly less than the population size.
The sample is a fair representation of the population.
Sample items are independent(one item has no bearing on the probability of another).
one sample z-test is used to
test whether the mean of a population is less than, greater than, or equal to some specific value.
what does the z-test assume
assumes that the population standard deviation is known.
The data are continuous (not discrete).
The data is a simple random sample from the population of interest.
The data in the population is approximately normally distributed.
two sample z-test is used to
test whether two population means are equal.
what assumptions are made in two sample z-test
The data from each population are continuous (not discrete).
Each sample is a simple random sample from the population of interest.
The data in each population is approximately normally distributed.
The population standard deviations are known.
comparing counts in contigency tables
Pearson’s chi-squared test
the hypothesis of a Pearson’s chi-squared test
H0: (null hypothesis) The two variables are independent.
H1: (alternative hypothesis) The two variables are not independent.
##
## data: count
## X-squared = 35.334, df = 1, p-value = 2.778e-09
How can we interpret the R output?
p value less than 0.05 so refect null hypothesis
Fisher’s Exact test
is to test if there is association between variables in a contigency table concept, but for small samples
The power of a test is affected by a number of different things
(4)
- The significance level. Tests with a lower level have a lower power.
- The sample size. A larger sample size means more power.
- The standard deviation of the data. If the data are very spread, it is harder to tell the difference between two means - hence the power is lower.
- The effect size. i.e. the true difference between the two groups. The larger this is, the easier it is to
spot in the data, and hence, the larger the power.
What are the differences and similiraties between the unpaired t-test and the Mann-Whitney U test?
The Mann-Whitney test is used as a substitution for the unpaired t-test, when the assumptions of normality fail to be satisfied.
compares the median values in the two groups and not the mean like the t-test.
Is the Wilcoxon signed rank test, a parametric test?
no, its a Non-parametric test
same as The Mann-Whitney U test (Wilcoxon rank-sum test)
What are the Type I and Type II errors?
type I is faslse positive
type II is false negative
nonparametric test doesn’t assume
normality
what kind of test is used ff the data is not normally distributed but are symmetrically distributed around
the mean
valid to use parametric tests.
This is because the central limit theorem,
the means of samples which are symmetrically distributed tend to be normally distributed
if the sample size is large enough
what is done if the data is postive or negative skewed
transformation to
make the distribution more symmetrical
25 students took a test; the mean was predicited to be 58%
what test would used to test the different?
one sample t-test
Students were tested on their ability to predict how moving bodies behave, both before
and after attending a course on Newtonian physics.
what test would see if attending the course have a significant effect on their test scores
paired t-test
The pH of cactus cells was measured at dawn and at dusk using microprobes.
The cactus was identifiable, and two sets of measurements were carried out on it.
what test to anaylse?
two sample t-test
We can never use a Normal approximation to test whether two proportions are equal or not.
false
compare the proportion in one random sample to a specified population proportion
normal approximation