lecture 1-corrected

1. Course introduction and hypothesis testing fundamentals

This section summarizes the introductory material covering the course outline, the fundamental procedure of statistical hypothesis testing, and a detailed review of the one-sample t-test, including its non-parametric alternative, the Wilcoxon Signed-Rank test.

1.1 Course Outline and Lecture Overview

The course, HLST 2302 3.0 Statistical Methods in Health Studies II, begins by introducing the structure of the course and immediately delves into statistical concepts. The first lecture focuses specifically on the One-sample t-test and differentiates between parametric tests and their non-parametric counterparts. Subsequent topics scheduled include comparisons between two groups, independent t-tests, paired t-tests, and effect size calculations using Cohen's d 2 5.

1.2 Recap of Hypothesis Testing Fundamentals

Hypothesis testing is the primary method of statistical inference used to ascertain whether an observed difference between samples, or between a sample and a known population value, is attributable to random sampling error or reflects a genuine underlying effect. This method relies on establishing two competing hypotheses: the null hypothesis (H0H_0), which posits no effect, no difference, or no association, and the alternative (research) hypothesis (H1H_1), which reflects the investigator's belief. The entire process is designed to use information derived from a carefully selected sample to draw reliable conclusions about the entire target population 6.

This diagram illustrates the process of statistical inference where a sample is drawn from a target population to infer the behavior of the entire population.

The standardized steps for executing a hypothesis test are as follows 12 7:

  1. State the null hypothesis (H0H_0) and the alternative hypothesis (H1H_1).
  2. Select an appropriate test statistic and determine its corresponding sampling distribution.
  3. Compute the value of the test statistic using the collected sample data.
  4. Calculate the p-value and compare this value against the pre-determined significance level, α\alpha.
  5. Formulate a conclusion, deciding whether to reject or fail to reject the null hypothesis.

1.3 Review of the One-Sample t-Test

The one-sample t-test is employed to determine if the mean (xˉ\bar{x}) calculated from a single sample significantly deviates from a hypothesized population constant (μ\mu) when the true population standard deviation (σ\sigma) is unknown.

Example: An investigator tests if the mean weight of men in 2006 (μ\mu) is greater than the reported 2002 mean of 191 pounds.

  • H0H_0: μ=191\mu = 191
  • H1H_1: μ>191\mu > 191

Given a sample (n=100n=100) with a mean xˉ=197.1\bar{x} = 197.1 and a sample standard deviation s=25.6s = 25.6, with α=0.05\alpha = 0.05. The test statistic calculation proceeds as follows:

z=xˉ−μ0sn=197.1−19125.6100=6.12.56=2.38z = \frac{\bar{x} - \mu_0}{\frac{s}{\sqrt{n}}} = \frac{197.1 - 191}{\frac{25.6}{\sqrt{100}}} = \frac{6.1}{2.56} = 2.38

The resulting p-value is calculated as P(xˉ>197.1)=1−P(z<2.38)=1−0.9913=0.0087P(\bar{x} > 197.1) = 1 - P(z < 2.38) = 1 - 0.9913 = 0.0087. Since p-value=0.0087<α=0.05p\text{-value} = 0.0087 < \alpha = 0.05, the null hypothesis is rejected 8.

Calculation of the z-score for a one-sample t-test example.

The key characteristic defining the t-distribution, used in the one-sample t-test, is its degrees of freedom (df), which for this test is calculated simply as df=n−1df = n - 1. The t-distribution is a continuous probability model that resembles the standard normal distribution but adjusts its shape based on the sample size via the degrees of freedom.

A comparison of the standard normal z-distribution with t-distributions having different degrees of freedom (df), illustrating how the t-distribution becomes flatter and wider as df decreases.

A critical assumption of the t-test is that the variable of interest is approximately normally distributed in the population. Although the sample size in the previous example (n=100n=100) is large enough that the t-distribution closely approximates the z-distribution, the t.test() function in R is still appropriately used for this scenario9.

Tip: When nn is large (e.g., n≥30n \ge 30), the t-distribution converges rapidly toward the standard normal (z) distribution, meaning the choice between using z-test formulas or the t-test function yields nearly identical results.

1.4 Selection of Test Statistic and Critical Values

The choice between a zz-test and a tt-test often relates to whether σ\sigma is known. However, when determining critical values for testing or constructing confidence intervals, the distribution shape is paramount. For instance, critical values define the boundaries of rejection regions corresponding to specific confidence levels (α\alpha).

Two diagrams illustrating critical values for confidence intervals based on different confidence levels (90% and 95%).

For a 95%95\% confidence interval, the critical z-values are ±1.96\pm 1.96, leaving 2.5%2.5\% in each tail (α/2=0.025\alpha/2 = 0.025). Conversely, for a 90%90\% confidence interval, the critical z-values are ±1.645\pm 1.645, leaving 5%5\% in each tail 10.

1.5 Non-Parametric Alternatives

When the assumption of approximate normality for the outcome variable cannot be reasonably met, especially with small sample sizes, the parametric one-sample t-test is inappropriate. In such cases, the Wilcoxon Signed-Rank test is used as the non-parametric equivalent for a one-sample test. This test offers an alternative by comparing the median of the sample against the specified fixed median value, rather than comparing the mean. Further details on non-parametric methods are slated for the following lecture 11.

An illustration shows a person holding a lightbulb, representing the solution or idea to use the Wilcoxon Signed-Rank Test.

2. Choosing the appropriate statistical test

The selection of the appropriate statistical test is a systematic process determined by several key characteristics of the research design and data, including the number of groups being compared, the relationship between those groups, the scale level of the variable of interest, and whether the data meets the assumptions for parametric testing. Statistical tests are broadly divided into parametric tests, which assume data normality and homogeneity of variance, and non-parametric tests, which are used when these assumptions are violated or the data is ordinal.

Tip: Many parametric tests are robust to minor violations of normality, especially with large sample sizes (n≥30n \geq 30), due to the Central Limit Theorem (CLT). If there is doubt, performing both parametric and non-parametric tests and checking for consistent conclusions is advisable.

2.1 Parametric versus Non-parametric considerations

Parametric tests rely on specific assumptions about the population distribution, such as normality and homogeneity of variance. If these assumptions are significantly unmet, or if the data is ordinal (categorical rank data), non-parametric alternatives must be employed 13.

  • Parametric Tests: Assume underlying population parameters (e.g., mean, variance) can be estimated and that the data comes from a normally distributed population.
    • Example: T-tests.
  • Non-parametric Tests: Do not rely on stringent distribution assumptions and are suitable for ordinal data or small samples where normality cannot be assumed.
    • Example: Mann-Whitney U test.

A comparison chart outlining the assumptions and examples for Parametric Tests versus the conditions for use and examples for Non-Parametric Tests.

2.2 Defining the Research Question and Hypothesis

Before selecting a test, researchers must clearly define their comparison and potential directional prediction. Statistical tests address the null hypothesis (H0H_0), which posits no difference exists between groups, with any observed difference attributed to sampling error.

  • Two-tailed test: Used when researchers predict a significant difference exists but cannot specify the direction (e.g., Group A ≠\neq Group B). This divides the rejection region (α\alpha) equally on both tails of the distribution.
  • One-tailed test: Used when researchers specifically predict the direction of the difference (e.g., Group A >> Group B). The entire rejection region (α\alpha) is concentrated on one side of the distribution curve 14.

This diagram illustrates the difference between one-tailed and two-tailed hypothesis tests using t-distribution curves.

2.3 Key Decision Factors for Test Selection

The choice of the correct statistical technique hinges on a sequential evaluation of the study design characteristics 16:

  1. Number of Samples/Groups/Conditions: Are you comparing one sample, two samples, or three or more?
  2. Type of Variable: Is the variable of interest measured on a scale (interval/ratio) or ordinal scale?
  3. Data Distribution: Is the data normally distributed (parametric) or not (non-parametric)?
  4. Relationship Between Samples: Are the samples independent (different subjects in each group) or related/repeated measures (same subjects measured multiple times)?

When faced with a statistical question, these factors guide the decision tree 17:

  • How many groups am I comparing?
  • Are these groups independent or repeated?
  • What is the variable of interest (scale or ordinal)?
  • If scale, is the population distribution known (if not, check sample size nn)?

Comprehensive tables summarize these decision paths, categorizing tests based on group count and data dependency/type.

A table summarizing appropriate statistical tests based on the number of groups and whether the data is parametric or non-parametric.

This table summarizes the appropriate statistical tests (parametric vs. non-parametric) based on the number of groups (1, 2, or ≥3) and data dependency.

2.4 Test Selection Based on Group Comparison Structure

Statistical tests are chosen based on how many points of comparison are present (one, two, or three or more) and whether the data permits parametric analysis.

Two Groups Comparison

For comparing exactly two groups, the choice depends on data dependency and parametric assumptions:

  • Two Independent Groups, Scale Data (Parametric): Independent Samples t-test. If data are not normal and n<30n < 30, the non-parametric alternative is the Mann-Whitney U test.
  • Two Repeated/Paired Groups, Scale Data (Parametric): Paired Samples t-test (or Dependent t-test). If assumptions fail, the Wilcoxon Signed-Rank Test is the non-parametric alternative.

Example: Comparing the length of stay (scale variable) between male (n=106n=106) and female (n=94n=94) patients suggests an Independent t-test because the groups are independent and n≥30n \geq 30 (allowing reliance on CLT robustness) 18.

Example: Comparing blood pressure (scale variable) taken at 8AM versus 8PM in the same patients (n=73n=73) requires a Paired t-test because the measures are from the same group (repeated) 19.

Three or More Groups Comparison

When comparing three or more groups, Analysis of Variance (ANOVA) techniques are typically used, again with parametric and non-parametric options available.

  • Independent Groups, ≥3\geq 3 Groups (Parametric): One-Way ANOVA. If assumptions fail or data is ordinal, the Kruskal-Wallis ANOVA is used.

    Example: Comparing resource intensity weight (scale) across short, medium, and long-stay hospitalizations (three independent groups, n=25n=25 each). Since n<30n < 30, the Kruskal-Wallis ANOVA is selected 20.

  • Repeated Measures, ≥3\geq 3 Groups (Parametric): One-Way Repeated Measures ANOVA. The non-parametric equivalent is Friedman's ANOVA.

    Example: Comparing Timed Up and Go (TUG) scores across four time points (initial, interim1, interim2, final) for the same residents (n=150n=150). This requires a One-Way Repeated Measures ANOVA due to four repeated groups and large sample size [n≥30n \geq 30] 23.

One Group Comparison

When comparing a single sample mean or median against a known standard or hypothetical value:

  • If comparing a single sample's scale variable against a known value, and n<30n < 30, the Wilcoxon Signed-Rank Test might be appropriate if normality assumptions are suspect, as suggested in an example where n=26n=26 21.

2.5 Considering Data Scale Level

The measurement scale of the variable of interest fundamentally restricts the test choice, regardless of group structure.

  • If the variable is scale (interval or ratio), parametric tests like tt-tests or ANOVA are preferred if assumptions hold.
  • If the variable is ordinal (ranked data), non-parametric tests must be used.

    Example: Comparing sex differences in Likert scale responses (ordinal) across two independent groups (males and females) requires the Mann-Whitney Test, as Likert data is not typically treated as normally distributed scale data 22.

This table outlines the appropriate statistical tests based on the number of groups and whether the data is parametric or non-parametric.

This table summarizes appropriate statistical tests based on the number of groups and whether the data is independent or repeated, distinguishing between parametric and non-parametric options.

3. Independent samples t-test and effect size calculation

The independent samples t-test is utilized to determine if there is a statistically significant difference between the means of two separate, unrelated groups, contrasting with the one-sample t-test which compares a single group mean to a known population mean. This test helps assess the signal (difference between means) relative to the noise (variability within the data).

Conceptual basis and hypothesis formulation

The independent samples t-test is conceptually designed to answer the question: Is there a difference between two distinct groups? For example, in a study comparing an intervention group (Cohort 1) to a control group (Cohort 2) on memory scores, the goal is to see if the intervention had an effect 24.

The hypotheses are formulated as:

  • Null Hypothesis (H0H_0): The population means are equal, μ1=μ2\mu_1 = \mu_2, meaning μ1−μ2=0\mu_1 - \mu_2 = 0.
  • Alternative Hypothesis (H1H_1): The population means are different (or specifically, one is greater than the other, μ1>μ2\mu_1 > \mu_2).

Example: If Cohort 1 is the intervention group and Cohort 2 is the control group, the hypotheses might be H0:μ1=μ2H_0: \mu_1 = \mu_2 and H1:μ1>μ2H_1: \mu_1 > \mu_2 25.

This diagram illustrates the conceptual difference between a one-sample t-test and an independent samples t-test using stick figures representing groups and a globe representing a population.

Calculating the t-statistic

The t-statistic quantifies the difference between the two means relative to the variability in the data, often described as the signal-to-noise ratio. A higher t-value suggests a larger signal relative to the noise, leading to a potentially significant result 26.

When testing the difference between two independent sample means, the t-statistic is calculated using the difference in sample means divided by the standard error of the difference.

The general structure mirrors the Z-statistic, but uses sample estimates for population parameters: t=xˉ1−xˉ2SExˉ1−xˉ2t = \frac{\bar{x}_1 - \bar{x}_2}{SE_{\bar{x}_1 - \bar{x}_2}}.

When the null hypothesis (μ1−μ2=0\mu_1 - \mu_2 = 0) is true, the tt-statistic simplifies to: t=xˉ1−xˉ2Sp1n1+1n2t = \frac{\bar{x}_1 - \bar{x}_2}{S_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}} 28.

Here, SpS_p represents the pooled standard deviation, which is computed as a weighted average of the standard deviations from the two samples 27.

Formulas for Z-statistic and T-statistic used in hypothesis testing for sample means.

The sign of the resulting tt-value depends on the order in which the groups are coded; swapping the group assignments (e.g., making Control Group 1 and Intervention Group 2) will flip the sign of tt while keeping the pp-value identical.

Assumptions and Levene's Test

Several assumptions must be met to appropriately use the standard independent samples t-test:

  1. The outcome variable must be approximately normally distributed within each population.
  2. The variances (σ2\sigma^2) in the two populations must be equal (homogeneity of variances).

If the data violates the assumption of equal variances, statistical software like R will automatically default to Welch's variation of the t-test, which corrects for unequal variances 29.

To formally test the homogeneity of variances assumption, Levene's test is performed. The null hypothesis for Levene's test states that the variances across all groups are equal.

  • If Levene's test is significant (p<0.05p < 0.05), the assumption is violated, and Welch's t-test (unequal variances assumed) must be used.
  • If Levene's test is non-significant (p>0.05p > 0.05), the assumption holds, and the standard t-test assuming equal variances is appropriate.

In an example run of Levene's test, the resulting pp-value was 0.72110.7211, leading to the conclusion that the variances were not significantly different, thus justifying the use of the t-test assuming equal variances 31.

Output from Levene's Test for Homogeneity of Variance in R, showing the F-value and p-value.

Tip: Always check the homogeneity of variances assumption first using Levene's test before interpreting the results of the standard tt-test, as this dictates which version of the test is valid 30.

Interpretation of the t-test output

Once the appropriate test is run (e.g., assuming equal variances, df=n1+n2−2df = n_1 + n_2 - 2), the output provides the tt-statistic and the associated pp-value.

For the example data, the output yielded t=3.3003t = 3.3003 with degrees of freedom df=18df = 18 and a two-tailed pp-value of 0.0039790.003979.

When a specific directional hypothesis (one-tailed) is stated (H1:μ1>μ2H_1: \mu_1 > \mu_2), the two-tailed pp-value reported by software must be halved to obtain the correct pp-value for the intended test. Halving the example pp-value gives 0.00198950.0019895. Since this value is less than the typical alpha level of 0.050.05, the null hypothesis is rejected, concluding that the intervention group had significantly higher mean memory scores 33.

Comparison of one-tailed and two-tailed t-distribution critical regions for hypothesis testing.

Confidence Intervals and Effect Interpretation

In addition to the pp-value, the 95% Confidence Interval (CI) for the mean difference provides insight into the magnitude and plausible range of the true effect size. For an observed mean difference of 4.104.10 (13.1−9.013.1 - 9.0), the 95% CI was reported as [1.49,6.71][1.49, 6.71].

A critical interpretation point regarding CIs:

  • If the confidence interval does not contain zero, it indicates that the true difference between the means is unlikely to be zero, supporting the conclusion of statistical significance (p<0.05p < 0.05).
  • If the CI includes zero (i.e., spans from negative to positive values), the true difference could plausibly be zero, suggesting the results are not statistically significant (p>0.05p > 0.05).

The output clearly displays the sample estimates, such as xˉintervention=13.1\bar{x}_{\text{intervention}} = 13.1 and xˉcontrol=9.0\bar{x}_{\text{control}} = 9.0.

Example: The statistical output showed a tt-statistic of 3.30033.3003, a pp-value of 0.0039790.003979, and a 95% CI for the mean difference of [1.490004,6.709996][1.490004, 6.709996] 34.

Output from an independent two-sample t-test showing test statistics and sample estimates.

When re-running the analysis with the coding reversed (Control group coded as 1, Intervention group as 2), the tt-statistic changes sign to −3.3003-3.3003, but the corresponding pp-value remains 0.0039790.003979 35.

Output from two-sample t-tests showing the results of statistical analysis under different coding schemes for groups. </document_content>

4. Effect size reporting and paired t-test

This section details the necessity and calculation of standardized effect sizes, specifically Cohen's d, and introduces the paired t-test as the appropriate inferential statistical method for analyzing dependent or matched samples.

4.1 Standardized Effect Size Reporting (Cohen's d)

Statistical significance alone (i.e., the p-value) does not convey the practical importance or magnitude of a finding, especially when comparing results across studies that use different measurement scales. To compare the magnitude of effects consistently, mean differences must be converted into standardized effect sizes, such as Cohen’s d, Glass’ g, or Pearson’s r. This summary focuses on Cohen's d 36.

Cohen's d standardizes the mean difference by dividing it by a measure of variability, making the result unit-free and comparable across different studies or scales.

Calculating Cohen's d

One common method for calculating Cohen’s d involves three conceptual steps:

  1. Subtract mean 2 from mean 1.
  2. Calculate the average of the standard deviations (SDs) of the two groups.
  3. Divide the result from Step 1 by the result from Step 2.

If groups are independent, an alternative is to pool the standard deviations of the two groups using a specific equation 38.

Tip: When interpreting Cohen's d, remember that the resulting value signifies how many standard deviations the means differ by 37.

Interpreting Cohen's d Guidelines

Cohen provided widely accepted guidelines for interpreting the magnitude of the standardized effect size:

  • d<0.2d < 0.2: Negligible effect
  • 0.2≤d<0.50.2 \leq d < 0.5: Small effect
  • 0.5≤d<0.80.5 \leq d < 0.8: Medium effect
  • d≥0.8d \geq 0.8: Large effect

For example, a raw mean difference of 10.27 might seem large, but a corresponding Cohen’s d of only 0.38 indicates a rather small effect size 39.

4.2 Comprehensive Reporting of Statistical Results

Standard practice dictates a comprehensive structure for reporting inferential test statistics, which must include both the test statistic outcome and an effect size estimate. The five essential components for reporting results are:

  1. Descriptive statistics for each group (e.g., means and standard errors).
  2. The finding to which the test relates, including the test statistic itself.
  3. The degrees of freedom (dfdf).
  4. The p-value associated with the test statistic.
  5. An estimate of the effect size (e.g., Cohen’s d).

To obtain comprehensive descriptive statistics beyond basic functions, packages like "pastecs" can be used to generate detailed summaries, including the Standard Error of the Mean (SE), which represents the standard deviation of the sample means 40 41.

Example: A report might state: "Results showed that, on average, the intervention group scored higher on memory (M=13.10M = 13.10, SE=0.78SE = 0.78) than the control group (M=9.00M = 9.00, SE=0.97SE = 0.97). The mean difference between the two groups, 4.10, 95% CI (1.49, 6.71), was statistically significant t=3.30t = 3.30, p=.003979p =.003979; and represented a large-sized effect, d=1.48d = 1.48." 18 42.

The descriptive statistics for two cohorts might look like the following summary: Descriptive statistics summary for intervention and control cohorts

And the supporting details for calculating standard error of the mean (SE) are based on the sample standard deviation (ss): Formula for sample standard deviation (s) and the formula for Standard Error of the Mean (SE).

4.3 The Paired t-test

The paired t-test is specifically designed for situations where samples are dependent, meaning the data consists of difference scores (dd) derived from matching observations (e.g., same subject measured twice, or matched pairs) This test assesses whether the population mean of these difference scores, denoted μd\mu_d, is significantly different from zero.

Conceptual Distinction: The paired t-test compares the same group across two time points (indicated by the clock), contrasting with the one-sample test (comparing a group to a fixed value/globe) or the independent samples test (comparing two distinct, unrelated groups) 43.

This diagram illustrates the conceptual differences between one-sample, independent samples, and paired samples t-tests using simple visual representations.

Calculation of the Paired t-statistic

The t-statistic for a paired t-test is calculated using the sample mean difference (xˉd\bar{x}_d) and the standard error of the difference scores (sd/ns_d / \sqrt{n}) 44.

The general formula for the t-statistic is: t=xˉd−μdsd/nt = \frac{\bar{x}_d - \mu_d}{s_d / \sqrt{n}}

Given that the null hypothesis (H0H_0) posits no difference, μd=0\mu_d = 0. This simplifies the resulting t-statistic calculation to the mean difference divided by the standard error of the difference: t=xˉdsd/nt = \frac{\bar{x}_d}{s_d / \sqrt{n}}

Formulas for calculating the t-statistic in a paired t-test, showing the general form and the simplified form when the null hypothesis is that the mean difference is zero.

Paired t-test Example and Reporting

Consider an example where 23 participants' Verbal IQ (viq) and Performance IQ (piq) scores are compared. The hypotheses might be set as H0:μd=0H_0: \mu_d = 0 and H1:μviq−μpiq<0H_1: \mu_{viq} - \mu_{piq} < 0. The order of subtraction in the t-test function (e.g., viq – piq vs. piq – viq) determines the sign of the resulting mean difference and t-value 45.

The sample data illustrating the paired scores is presented below: A table displaying paired Verbal IQ (viq) and Performance IQ (piq) scores for 23 participants.

If the analysis yields a tt-value of −0.76548-0.76548 with df=22df = 22 and a two-tailed pp-value of 0.45210.4521, the negative tt-value indicates that the mean of the first condition (viq) was smaller than the mean of the second (piq).

Output from a paired t-test calculation showing the test statistic, degrees of freedom, and p-value.

If the hypothesis was one-tailed, the pp-value would be halved (0.4521/2=0.226050.4521 / 2 = 0.22605). Since this pp-value is greater than the standard α=0.05\alpha = 0.05, the null hypothesis is not rejected, suggesting no significant difference between viq and piq scores 46.

To fully report the findings, Cohen's d must also be calculated for the paired data, often using software functions like cohensD(). Descriptive statistics like mean and standard error for both paired variables can be generated using functions like stat.desc() combined with cbind() 47 48.

A typical reporting statement for this non-significant result, including effect size (d=0.16d = 0.16), would be: "Although the difference between the groups was in the expected direction (viq M=110.52,SE=2.62M = 110.52, SE = 2.62; piq M=112.22,SE=1.96M = 112.22, SE = 1.96), results showed that this difference, −1.70-1.70, 95% CI (−6.29,2.90)(-6.29, 2.90) was not statistically significant t=−.77t = -.77, p=.22605p =.22605; and represents a negligible effect, d=.16d =.16." 22 49.

Application Note: The paired t-test is appropriate when assessing pre- and post-intervention measurements on a normally distributed variable for the same group of subjects 51.

Common mistakes to avoid

  • Review all topics thoroughly before exams
  • Pay attention to formulas and key definitions
  • Practice with examples provided in each section
  • Don't memorize without understanding the underlying concepts

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also