









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Hypothesis Testing: One-Sample T-test Hypothesis Test ● A hypothesis test consists of two hypotheses: a null hypothesis and an alternative hypothesis. ● The test assesses whether the null hypothesis is a good explanation of the data. ● The two possible outcomes of the test are: ○ Reject the null hypothesis in favor of the alternative hypothesis, or ○ Fail to reject the null hypothesis ● Note that you never “prove” or “accept” the null hypothesis.
Null Hypothesis ● A null hypothesis is a statement about the value of population parameters or about distribution of the data in the population. ● In this course, we will focus mostly on null hypothesis concerning the value of population means. ○ Remember, however, that a null hypothesis could also be about other population parameters or about population distributions. ○ For instance, the null in Levine’s test is about population variances, and the null in the Shapiro-Wilk test is about population distributions.
Null Hypothesis Considerations ● Often, the null hypothesis is a commonly accepted belief that you want to challenge. ● A null hypothesis may claim that: ○ A population does not change over time ○ There is no difference between two or more populations ○ There is no relationship between two or more variables ● Any observed change in a population over time, any observed difference between populations, or any observed relationship between variables is then attributed to sampling error.
Alternative Hypothesis ● Any hypothesis that differs from the null hypothesis is called an alternative hypothesis. ● The alternative hypothesis is your research hypothesis, i.e, the claim that you expect the data will support. ○ Often the alternative hypothesis simply states that the value of the population parameter is not equal to the value in the null hypothesis. ○ But sometimes the alternative hypothesis states that a population is either greater or less than the value in the null hypothesis.
Assumptions ● We need two main assumptions to use the methods covered in this lecture: ○ Normality Assumption: The observations in the sample are taken from a normal distribution.
○ Independence Assumption: The observations in the sample are independent of each other.
The One-Sample T-test - Steps The steps for testing hypotheses about means include:
The One-Sample T-test - Step 1: Null Hypothesis
The One-Sample T-test - Step 1: Alternative Hypothesis
The One-Sample T-test - Step 2
Threshold for p-value ● There is no universal rule about how small the p-value must be to reject the null hypothesis. ● In social sciences, the thresholds commonly used to decide if a p-value is small enough to reject the null are 0.05, 0.01, and 0.001. ○ The 0.05 threshold, in particular, is an established convention in many disciplines.
Alpha Level ● The threshold below which a p-value is small enough to reject the null hypothesis is called an alpha level, denoted α, that is: ○ We reject if p-value < α and fail to reject if p-value ≥ α. ● The alpha level is also called the significance level. ○ When we reject the null hypothesis, we say that the test is “significant at that level.” For example, if we reject the null hypothesis at the 0.05 alpha level, we may say that our test is significant at the 5% level.
Confidence Intervals and Hypothesis Tests ● Note that confidence intervals and hypothesis tests are better viewed as complements rather than substitutes.. ● A confidence interval gives you a range of plausible values for the population mean. ○ But tells you nothing about the strength of the evidence against the null hypothesis. ● A hypothesis test measures the strength of the evidence against the null hypothesis. ○ But tells you nothing about plausible values for the population mean.
Conclusions of Hypothesis Test ● A hypothesis test provides an assessment of the strength of the evidence against the null hypothesis. ● If you fail to reject the null hypothesis, you proved that the evidence against the null is not strong enough. ○ The null hypothesis may well be false, however we do not have enough evidence to reject it. ● Similarly, if you reject the null hypothesis, you proved that the evidence against the null is strong enough.. ○ Yet the null hypothesis may well be true, even though we have enough evidence to reject it.
Reject the Null - What are we proving? ● If we reject the null hypothesis, all we are saying is that under the null it is highly unlikely to see a random sample like ours. ○ Yet, we are actually seeing a random sample like ours. ○ Hence, we reject the null because it provides a poor account of the data at hand, i.e., it can only describe our sample data as unusual.
○ Even so, since we cannot prove that our sample data is not unusual, we cannot claim that the null is false.
Fail to Reject the Null - What are we proving?
● Similarly, if we fail to reject the null hypothesis, all we are saying is that under the null it is not highly unlikely to see a sample like ours. ● In other words, we fail to reject the null hypothesis because it does not describe our sample data as unusual. ○ Again, since we cannot prove that our sample data is not unusual, we cannot claim that the null is true.
Types of T Tests ● There are three types of one sample t tests depending on the alternative hypothesis we use: ○ Left-tailed test → HA: 𝜇 < 𝜇 0 ○ Right-tailed test → HA: 𝜇 > 𝜇 0 ○ Two-tailed test → HA: 𝜇 ≠ 𝜇 0 ● The right- and left- tailed test have the same p-value and are known as one-tailed (or one-sided) tests. ● The p-value of a two-sided test is twice the p-value of a one-sided test.
Types of T Tests - P-values ● Left-tailed test → p-value = P(z < -z) ● Right-tailed test → p-value = P(z > z) ● Two-tailed test → p-value = P(z < -z) + P(z > z) ● Since the normal distribution is perfectly symmetric: P(z < -z) = P(z > z) and P(z < -z) + P(z > z) = 2P(z > z).. ● Note: z is defined as 𝑧∗ = (x̄ - 𝜇0) / (𝜎/ 𝑛)
Types of T Tests - Considerations ● For the same data, the one-tailed p-value is always half the two-sided p-value. ○ Thus, a one-tailed test will reject the null hypothesis more often than a two-tailed test. ● It is often better to assume the alternative hypothesis is two tailed, i.e., Ha: 𝜇 ≠ 𝜇 0. ○ Ha: 𝜇 ≠ 𝜇 0 is a more conservative choice. ○ But it has the advantage that the results are easily matched to the confidence interval.
Confidence Levels and Alpha Levels ● Alpha levels for two-tailed tests are closely related to confidence levels for confidence intervals. ○ For instance, a 95% confidence level corresponds to a 5% alpha level.
Type II Error ● A larger 𝛼 leads to a smaller critical value 𝑥𝑐, decreasing the likelihood of a type II error. ● A smaller 𝛼 leads to a larger critical value 𝑥𝑐, increasing the likelihood of a type II error 𝛽.
Power ● If our test is strong enough, it should reject the null hypothesis when it is actually false. ● The probability of rejecting the false null hypothesis is called the power of the test. ○ Recall that 𝛽 is the probability of failing to reject a false null hypothesis ○ Thus, the power of the test, i.e., probability of rejecting a false null hypothesis, is 1 - 𝛽.
Choosing Significance Level ● Thus, when we choose the significance level we are choosing between: ○ Reducing the likelihood of a type I error by accepting a higher likelihood of a type II error. ○ or reducing the likelihood of a type II error by accepting a higher likelihood of a type I error. ● The only way to reduce the likelihood of both type I and type II errors is by increasing the sample size.
The Dependent and Independent Samples T-test Dependent T-test ● The dependent, or paired, samples t-test compares the means of two groups on the same continuous variables. ● The samples are said to be dependent because the observations in the two groups are linked and can be uniquely matched (i.e., paired) in a meaningful way.
Examples of Dependent T-test ● Often, paired data arises when we compare subjects with themselves before or after a treatment. ● Or when each subject in a group can be paired uniquely to a subject in other group, such as samples of siblings or samples of spouses.
Determining Paired Data ● There is no test to determine whether your data are paired. ○ You must determine that from understanding how your data was collected and what they mean.
Recognizing Paired Data ● One we recognize that the data are paired, we look at the pairwise differences between the two groups as if they were the data. ○ In other words, we use the data on pairwise differences between the two groups as our sample data.
○ Therefore, we can use a one sample t-test and a one-sample confidence interval to make inferences about the mean pairwise differences.
Dependent T-test Assumptions We need two main assumptions to use the methods covered in this lecture.
The Dependent Sample T-test - Steps Steps for testing a hypothesis about means:
NOTE: From now on, we no longer need to specify the model we use to test the null hypothesis because we will always use the Student’s t-model.
Dependent T-test and Student’s T Model ● The null hypothesis in a paired t-test is almost always the mean of paired differences μd, is 0 or H 0 : μd, = 0. ● We use the sample mean d bar, and standard deviation, sd, of paired differences to calculate the statistic: : t(n-1) = d bar/ (sd / √n). ● If the assumptions hold and the null hypothesis is true, we can model the sampling distribution t(n-1) using a Student's t model with n-1 degrees of freedom.
Dependent T-test and Confidence Interval ● The confidence interval for the mean of paired differences, 𝜇d, is: d bar ± t* x (sd / √n) ● The critical value t* from the Student's t model depends on the confidence level, c, that you specify and on the degrees of freedom n-1.
Dependent T-test Assumptions Flow Chart To decide whether you can use a paired samples t-test:
a. In other words, the score in one group provides no information about the scores in the other group. b. Usually, the independence of the groups from each other is evident in the way the data is collected.
Independent Samples T-test - Null Hypothesis ● The null hypothesis is an independent samples t test is that the difference between the two population means, , 𝜇 1 − 𝜇 2 , is equal to a hypothesized difference, Δ 0 , that is: ○ H 0 : 𝜇 1 − 𝜇 2 = Δ 0 ● It is so common for the hypothesized difference to be zero that we often assume Δ 0 = 0 and write: 𝐻 0 : 𝜇 1 − 𝜇 2 = 0.
Independent Samples T-test - T-statistic Formula ● The t statistic of interest is the standardized sample difference between the means of the two independent groups: ○ t = ((ȳ 1 - ȳ 2) - (μ1 - μ2)) / sqrt((s1^2 / n1) + (s2^2 / n2)) ● If the assumptions hold and the null hypothesis is true, we can model the sampling distribution of our t-statistic using a Student's t distribution with a number of degrees of freedom found with a special formula.
Independent Samples T-test - T-statistic and True Null Hypothesis Formula ● Note that if the null hypothesis is true, then 𝜇 1 − 𝜇 2 = 0 and our t statistic becomes t = (ȳ 1 - ȳ 2 ) / sqrt((s1^2 / n1) + (s2^2 / n2)). ● We use this sample statistic to test the null hypothesis 𝐻0: 𝜇1 − 𝜇2 = 0. ● The term SE = sqrt((s1^2 / n1) + (s2^2 / n2)) is the standard error of the sampling distribution of the mean difference ȳ 1 - ȳ2.
Independent Samples T-test - Degrees of Freedom Formula ● The formula for the number of degrees of freedom: df = ((s1^2 / n1) + (s2^2 / n2))^2 / ((1 / (n1 - 1)) (s1^2 / n1)^2 + (1 / (n2 - 1)) (s2^2 / n2)^2) ● The formula usually does not give a whole number of degrees of freedom. ● However, if the two populations beging compared have equal variances, then the formula for the number of degrees of freedom is simply: d.f.=n-2.
Deciding on Formulas of Degrees of Freedom to Use ● Before running a two-samples t test we must decide which formula for the degrees of freedom is the appropriate one for our analysis. ● We will use Levene’s test to decide which formula is appropriate. ● The null hypothesis in Levene’s test is that both populations have equal variances, therefore: ○ If we fail to reject the null hypothesis (i.e., if p ≥ 0.05), we should use the formula for populations with equal variances. ○ On the other hand, if we reject the null hypothesis (i.e., if p < 0.05), we should use the formula for populations with unequal variances.
Independent Samples T-test - Confidence Interval ● The confidence interval we build for the difference in means is called a two samples t interval. ● The confidence interval is just the statistic ȳ1 - ȳ2 plus or minus an estimated margin of error E. ○ CI = (ȳ 1 - ȳ 2) ± t* × sqrt((s1^2 / n1) + (s2^2 / n2)) ○ where E = t* × sqrt((s1^2 / n1) + (s2^2 / n2)) is the estimated margin of error.
Independent Samples t-test Assumptions Flow Chart
Independent Samples t-test Results Flow Chart
What Can Go Wrong? ● Don’t use independent sample methods when the samples are not independent. ○ These methods give wrong answers if the assumption of independence is violated. ○ Good random sampling is often the best assurance of independence. ● Don’t interpret a significant difference in means casually. ○ It is possible that a confounding variable not accounted for is the real reason for observed difference.
Homogeneity of Variance Assumption ● The populations have the same variance, that is to say, each treatment group has population variance equal to 𝜎^2. ● The requirement of equal population variances can be relaxed if the sample size for each group is the same, that is, if n 1 =n 2 =...=nk. ● If the sample size for each group is not the same, then we check the homogeneity of variances assumption using Levene’s test for equality of variances.
Variabiltiy ● The ANOVA test compares the between-group variance and the within-group variance.
Between-Group Variance ● The between-group variance is the spread of the sample means across treatment groups. ● It represents the effect of the different treatments on the dependent variable.
Within Group Variance ● The within group variance (or residual variance) is the spread of the scores within each treatment group. ● It represents the naturally occurring variability due to individual differences that are left unexplained by the treatment.
Sampling Variability ● Sample means will always differ somewhat due to random sampling. ● ANOVA requires evidence that the differences are larger than would be expected by chance, relative to within-group variability.
Expected vs. Observed Variation ● Under the null hypothesis, MSw (within-group variance) indicates the amount of variation expected among sample means due to sampling error. ● If the observed variation among sample means (MSb) exceeds this expected amount, the null becomes unlikely.
ANOVA - Methods ● ANOVA assumes all samples come from the same normal distribution with equal variances and the same mean. ● It tests how likely it is to observe sample means as different as the ones we have.
ANOVA - Fail to Reject Null Hypothesis ● We fail to reject the null when the sample means are not spread out enough compared to the within-group variability. ● In this case, the differences can be explained by normal sampling variation, so the data are consistent with all groups coming from the same population.
ANOVA - Reject the Null Hypothesis ● We reject the null hypothesis in favor for the alternative hypothesis when the sample means differ so much that it is unlikely they came from the same population. ● This suggests at least one group has a different true mean.
ANOVA F-ratio ● The one-way ANOVA F-ratio is: F= (between group variance)/(within group variance) or F=MSb/MSw.
Understanding the F-Ratio ● ANOVA uses the F-ratio (MSb/MSw), which follows an F-distribution when assumptions are met and the null hypothesis is true.
1 or less. ● We reject the null hypothesis only when the F-ratio is unusually larger, meaning it is unlikely to have occurred by chance and produces a small p-value.
The Formula and Meaning of MSw and MSb ● MSw represents the amount of variation we would expect among sample means if the null hypothesis is true. ● MSb represents the actual variation we observe between the sample means.
Decision Rules for the F-Ratio ● If MSB ≤ MSW (i.e., F ≤ 1), we fail to reject the null hypothesis because the variation we see is close to what we expect to see if the null is true. ● But if MSB > MSW (i.e., F > 1), we may reject the null hypothesis because the variation we see is unusual if the null is true.
Measuring the Effect Size ● ANOVA separates the total variability in the data (SST) into variability explained by grup differences (SSB) and variability that remains within groups (SSW). ● Since SST = SSB + SSW, the effect size η² is calculated as SSB/SST, representing the proportion of total variation explained by the group differences.
Eta-squared
Cohen Effect Size (1998) ● η2 < 0.01 represents a "negligible" effect ● 0.01 ≤ η2 < 0.06 represents a "small" effect ● 0.06 ≤ η2 < 0.14 represents a "medium" effect ● η2 ≥ 0.14 represents a "large" effect
Post-hoc Multiple Comparison Tests ● A significant ANOVA only indicates that at least one mean differs.