Fiveable

๐ŸŽฒData, Inference, and Decisions Unit 6 Review

QR code for Data, Inference, and Decisions practice questions

6.3 One-sample and two-sample tests (t-tests, z-tests)

๐ŸŽฒData, Inference, and Decisions
Unit 6 Review

6.3 One-sample and two-sample tests (t-tests, z-tests)

Written by the Fiveable Content Team โ€ข Last updated September 2025
Written by the Fiveable Content Team โ€ข Last updated September 2025
๐ŸŽฒData, Inference, and Decisions
Unit & Topic Study Guides

One-sample and two-sample tests are key tools in hypothesis testing. They help us compare data to known values or between groups. These tests, like t-tests and z-tests, let us draw conclusions about populations based on sample data.

Choosing the right test depends on your research question and data type. One-sample tests compare a single group to a known value, while two-sample tests compare two groups. Understanding when to use each test is crucial for accurate statistical analysis.

One-sample vs Two-sample Tests

Distinguishing Between Test Types

  • One-sample tests compare single sample mean or proportion to known population parameter or hypothesized value
  • Two-sample tests compare means or proportions between two independent groups or paired observations
  • Selection depends on research question, study design, and available data
  • One-sample tests suit before-after studies, quality control assessments, comparisons to established standards
  • Two-sample tests fit comparing outcomes between treatment and control groups, examining differences between distinct populations
  • Data nature (continuous or categorical) and sample size influence specific test selection (t-test, z-test, non-parametric alternatives)
  • Null and alternative hypotheses formulation determines one-sample or two-sample test requirement

Applications and Examples

  • One-sample test examines whether average test scores in a class (sample) differ from the school's historical average (population parameter)
  • Two-sample independent test compares mean blood pressure between patients receiving new drug vs placebo
  • Two-sample paired test evaluates weight loss in individuals before and after a diet program
  • One-sample proportion test assesses if the proportion of defective items in a production batch exceeds the acceptable limit
  • Two-sample proportion test compares voter turnout rates between two different electoral districts

Performing and Interpreting t-tests

One-sample t-tests

  • Compare sample mean to known or hypothesized population mean, assuming normality
  • Calculate t-statistic by dividing difference between sample and population means by standard error
  • Degrees of freedom equal sample size minus one (n - 1)
  • Formula: t=xห‰โˆ’ฮผs/nt = \frac{\bar{x} - \mu}{s / \sqrt{n}}
    • $\bar{x}$ sample mean
    • $\mu$ population mean
    • $s$ sample standard deviation
    • $n$ sample size
  • Example: Testing if average height of basketball players in a league differs from national average

Two-sample t-tests

  • Independent samples t-test compares means between two unrelated groups
  • Dependent samples t-test (paired t-test) compares means of paired observations
  • Independent t-test calculates t-statistic using difference between two sample means divided by standard error of the difference
  • Levene's test checks equal variances assumption, determines use of pooled or separate variance estimates
  • Degrees of freedom calculation varies based on equal or unequal variance assumption
  • Paired t-test uses differences between paired observations, degrees of freedom equal number of pairs minus one
  • Example: Comparing average salaries between two different industries (independent) or employee satisfaction before and after training program (paired)

Interpreting t-test Results

  • Examine t-statistic, degrees of freedom, p-value, confidence intervals to draw conclusions about null hypothesis
  • Calculate and report effect size measures (Cohen's d) to indicate observed difference magnitude
  • Cohen's d formula: d=xห‰1โˆ’xห‰2spooledd = \frac{\bar{x}_1 - \bar{x}_2}{s_{\text{pooled}}}
  • Interpret effect sizes: small (0.2), medium (0.5), large (0.8)
  • Example interpretation: "The t-test revealed a significant difference (t(58) = 3.24, p < .01, d = 0.85) between treatment and control groups, with a large effect size"

Z-tests for Proportions

One-sample Proportion Tests

  • Compare sample proportion to known or hypothesized population proportion
  • Calculate z-statistic using difference between observed and expected proportions, divided by standard error of proportion
  • Formula: z=p^โˆ’p0p0(1โˆ’p0)nz = \frac{\hat{p} - p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}
    • $\hat{p}$ sample proportion
    • $p_0$ hypothesized population proportion
    • $n$ sample size
  • Require sufficiently large sample sizes (np โ‰ฅ 5 and n(1-p) โ‰ฅ 5) for normal approximation to binomial distribution
  • Example: Testing if proportion of left-handed people in a sample differs from known population proportion

Two-sample Proportion Tests

  • Compare proportions between two independent groups
  • Use pooled estimate of proportion to calculate standard error under null hypothesis of no difference
  • Formula: z=p^1โˆ’p^2p^(1โˆ’p^)(1n1+1n2)z = \frac{\hat{p}_1 - \hat{p}_2}{\sqrt{\hat{p}(1-\hat{p})(\frac{1}{n_1} + \frac{1}{n_2})}}
    • $\hat{p}_1, \hat{p}_2$ sample proportions
    • $\hat{p}$ pooled proportion estimate
    • $n_1, n_2$ sample sizes
  • Apply continuity correction (Yates' correction) to improve approximation of discrete binomial by continuous normal distribution
  • Example: Comparing proportion of smokers between two different age groups or geographic regions

Interpreting Z-test Results

  • Examine z-statistic, p-value, confidence intervals to draw conclusions about null hypothesis
  • Calculate confidence intervals for proportions using formula: p^ยฑzฮฑ/2p^(1โˆ’p^)n\hat{p} \pm z_{\alpha/2}\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}
  • Interpret results in context of research question and practical significance
  • Example interpretation: "The z-test showed a significant difference in proportions (z = 2.86, p < .01), with a 95% confidence interval for the difference in proportions of [0.03, 0.15]"

Choosing the Right Test Statistic

Factors Influencing Test Selection

  • Data type (continuous or categorical) guides choice between t-tests and z-tests for proportions
  • Sample size determines use of t-statistics (small samples) or z-statistics (large samples, n > 30)
  • Population standard deviation knowledge influences z-statistic use (known ฯƒ) vs t-statistic (unknown ฯƒ)
  • Null and alternative hypotheses determine one-tailed or two-tailed tests, affecting p-value calculation and interpretation
  • Assumptions about population distribution shape test statistic choice (normal distribution for parametric tests)
  • Example: Choose z-test for large sample (n = 500) comparing proportion of college graduates in two cities, t-test for small sample (n = 20) comparing mean exam scores between two classes

Calculating and Interpreting P-values

  • P-values represent probability of obtaining test statistic as extreme as or more extreme than observed value, assuming null hypothesis true
  • Calculate t-test p-values using t-distribution with appropriate degrees of freedom
  • Determine z-test p-values using standard normal distribution
  • Compare significance level (ฮฑ) to p-value for hypothesis testing decision-making
  • Use critical values from statistical tables or software as alternative method for decision-making
  • Example interpretation: "The calculated p-value of 0.003 is less than the significance level of 0.05, leading to rejection of the null hypothesis"

Practical Considerations

  • Consider practical significance alongside statistical significance when interpreting results
  • Report effect sizes and confidence intervals to provide comprehensive understanding of findings
  • Account for multiple comparisons when conducting several tests to control overall Type I error rate (Bonferroni correction)
  • Evaluate test assumptions and consider non-parametric alternatives when assumptions violated
  • Example: Wilcoxon rank-sum test as non-parametric alternative to independent samples t-test when normality assumption violated