Understanding T-Tests in Statistics

Nov 1, 2024

Lecture on T-Tests

Types of T-Tests

Independent Samples T-Test

  • Used when two groups are independent.
  • Example: Experimental group vs. control group.

Paired Samples T-Test

  • Also known as:
    • Within Subjects T-Test
    • Repeated Measures T-Test
    • Dependent T-Test
  • Involves measuring the same participants twice, in different conditions.
  • Example: Exam scores with caffeine vs. without caffeine, same participants tested in both conditions.
  • Measurements are paired because they're from the same individual.

Paired Samples T-Test Example: Coffee Experiment

  • Participants tested in two conditions: regular coffee and decaf.
  • Measurements taken twice for each participant to form paired data.

Paired Samples T-Test Explanation

  • Within Subjects: Manipulation occurs within the same subjects.
  • Repeated Measures: Subjects measured more than once.
  • Dependent T-Test: Measurements have a dependency, since they come from the same person.

Performing Paired Samples T-Test

Step 1: Calculate Difference Scores

  • Subtract one condition's scores from the other.
  • Example data file: candles_wide.csv.

Step 2: Conduct One-Sample T-Test on Differences

  • Calculate mean and standard deviation of difference scores.
  • Hypothesis testing:
    • Null Hypothesis (H₀): No difference between conditions.
    • Alternative Hypothesis (H₁): There is a difference.

Data Analysis in R

  • Load data with read.csv.
  • Calculate mean, standard deviation, standard error in R.
  • Set confidence level alpha = 0.05.

Statistical Calculation

  • Degrees of Freedom (n-1).
  • Critical t-values for significance.
  • Confidence Interval calculated from mean difference ± t critical * standard error.

Confidence Interval and P-Value

  • Confidence Interval: Determines if the null hypothesis (no difference) can be rejected.
  • P-Value: Probability of the observed results under the null hypothesis. Lower p-value suggests significant difference.

Conclusion

  • Reject null hypothesis if 0 is not within the confidence interval.
  • Calculate P-Value using two-sided test.

R-Script for T-Test

  • Use t.test() function for paired samples.
  • Provide dataset columns and specify paired data and alternative hypothesis.
  • Confirm computed values with R output.

Key Takeaways

  • Understand the conditions for using independent vs. paired samples t-tests.
  • Execute calculations and analyze data using R effectively.
  • Interpret statistical outputs in the context of hypothesis testing.