2024-03-22

Slide 1: Introduction

  • Hypothesis testing is a statistical method used to make inferences about a population parameter based on sample data.

  • It involves formulating two competing hypotheses: the null hypothesis (H0) and the alternative hypothesis (H1).

  • We collect sample data and use it to assess the strength of evidence against the null hypothesis.

Slide 2: Null and Alternative Hypothesis

  • Null Hypothesis (H_0): This represents the assumption of no effect or no difference. It is typically denoted as H0.

-Alternative Hypothesis (H_a or H_1): Represents the claim or statement that contradicts the null hypothesis.

  • H_0: No effect or no difference
  • H_1: Some effect or difference exists

Slide 3: Example: Hypothesis Testing for Mean

  • Suppose we want to test whether the mean IQ of a population is equal to 100.

  • Null Hypothesis (H0): Mean IQ = 100

  • Alternative Hypothesis (H1): Mean IQ ≠ 100

  • We collect a sample of IQ scores and perform hypothesis testing to determine if there is enough evidence to reject the null hypothesis.

Slide 4: Test Statistics

  • Test statistics are used to quantify the difference between the observed data and what is expected under the null hypothesis.

  • Commonly used test statistics include z-score, t-score, and chi-square statistic.

  • Example:

  • If we want to test the mean height of adults, we can use the t-test statistic.

Slide 5: p-value

    • The p-value is the probability of obtaining a test statistic as extreme as the one observed, assuming the null hypothesis is true.
  • It measures the strength of evidence against the null hypothesis.

  • If the p-value is smaller than a pre-defined significance level (usually 0.05), we reject the null hypothesis.

  • Example:

  • If the p-value is 0.02, we reject the null hypothesis at the 0.05 significance level.

Slide 6: Type I and Type II Errors

  • Type I Error: Rejecting the null hypothesis when it is actually true.

  • Type II Error: Failing to reject the null hypothesis when it is actually false.

  • The significance level (α) determines the probability of making a Type I Error. The power (1-β) determines the probability of correctly rejecting a false null hypothesis.

  • Example:

  • Type I Error: Convicting an innocent person.

  • Type II Error: Failing to convict a guilty person.

Slide 7: Example: T-Test for Mean Height

  • Dataset: Let’s consider a dataset of heights of 100 adults.

  • H0: The mean height of adults is 165 cm.

  • Ha: The mean height of adults is not equal to 165 cm.

  • We will perform a t-test to test the null hypothesis.

Slide 8: R Code and Plot

  • R Code:
# Load dataset
heights <- c(168, 172, 170, 165, 173, 169, 167, 166, 171, 168)

# Perform t-test
result <- t.test(heights, mu = 165)

# Print test result
print(result)
  • Plot:
  • A boxplot of the heights of adults.

Slide 9: Conclusion

  • Hypothesis testing is a fundamental statistical method used to make inferences about populations based on sample data.

  • It involves formulating null and alternative hypotheses, selecting a significance level, and using test statistics to calculate p-values.

  • The p-value helps determine the strength of evidence against the null hypothesis, and decisions are made based on comparing the p-value to the significance level.

  • Type I and Type II errors should be considered when interpreting the results of hypothesis tests.

  • R provides various functions and packages to perform hypothesis tests, such as t-tests, chi-square tests, and ANOVA.

  • Understanding hypothesis testing is essential for making informed decisions and drawing accurate conclusions based on data analysis.