Correlation and Simple Linear Regression for Pharmacy Students
On this page
Paired quantitative data & scatterplots
In pharmacy practice, pharmaceutical analysis, and clinical trials, biostatisticians regularly evaluate two continuous numerical characteristics measured simultaneously on the same experimental unit, patient, or formulation batch. Such observations are termed paired quantitative data. Each observation consists of an ordered pair (xi, yi), where i = 1, 2, …, n.
Before computing any summary statistic, you must identify the scientific roles of the two variables:
- Explanatory (Predictor or Independent) Variable (X): The variable that is manipulated, fixed by protocol, or hypothesized to precede or influence the outcome (such as administered drug dose, dissolution duration, or manufacturing compression pressure). In graphs, X is placed on the horizontal axis (abscissa).
- Response (Outcome or Dependent) Variable (Y): The measured variable hypothesized to change in response to X (such as peak drug serum concentration, percentage of active pharmaceutical ingredient dissolved, or tablet crushing strength). In graphs, Y is placed on the vertical axis (ordinate).
As covered in presentation of data in descriptive biostatistics, the foundational graphic for paired numerical data is the scatterplot. A scatterplot displays each bivariate observation as an unjoined point plotted on a Cartesian coordinate plane.
Systematic Evaluation of a Scatterplot
When inspecting any pharmacy scatterplot, systematically evaluate four visual features:
- Direction: An association is positive if larger values of X correspond to larger values of Y (the cloud slopes upward from left to right). It is negative if higher values of X correspond to lower values of Y (sloping downward from left to right). If Y shows no systematic change across values of X, the association is zero.
- Form: Look for the geometric shape traced by the points. A linear association forms a straight-line trend. A non-linear or curvilinear relationship traces an arc, exponential curve, or plateau (common in receptor-binding saturation and enzyme kinetics).
- Strength: Refers to how closely the plotted points cluster around the underlying geometric path. Tightly clustered points denote strong linear association; widely dispersed points denote weak association.
- Unusual Observations: Detect bivariate outliers (points that sit far from the main cloud) and high-leverage points (extreme values on the X-axis).

Covariance & Pearson correlation coefficient
To quantify what the eye detects on a scatterplot, we begin with sample covariance (sxy or Cov(X,Y)). Covariance measures the average joint deviation of paired observations from their respective sample means (x̄ and ȳ):
sxy = (Σi=1n (xi – x̄)(yi – ȳ)) ÷ (n – 1)
The intuition rests on dividing the scatterplot into four quadrants centered at (x̄, ȳ):
- If a point has both xi > x̄ and yi > ȳ, the product (xi – x̄)(yi – ȳ) is positive ([+] × [+] = [ + ]).
- If a point has both xi < x̄ and yi < ȳ, the product is also positive ([-] × [-] = [ + ]).
- If x and y deviate in opposite directions, the product is negative.
While the sign of sxy communicates the direction of association, its numerical magnitude depends on the original units of measurement (for example, milligrams × minutes). Changing units from grams to milligrams multiplies covariance by 1,000, even though the biological relationship is unchanged. Covariance cannot tell us how strong an association is.
The Pearson Product-Moment Correlation Coefficient (r)
To eliminate unit dependence, Karl Pearson standardized covariance by dividing it by the product of the individual sample standard deviations (sx and sy). The resulting Pearson product-moment correlation coefficient (r) is completely dimensionless:
r = (sxy) ÷ (sx sy) = (Σ (xi – x̄)(yi – ȳ)) ÷ (√(Σ (xi – x̄)2 Σ (yi – ȳ)2)) = (SSxy) ÷ (√(SSxx · SSyy))
Where the sums of squares and cross-products are defined as:
- Corrected Sum of Squares for X (SSxx): Σ (xi – x̄)2 = Σ xi2 – ((Σ xi)2) ÷ (n)
- Corrected Sum of Squares for Y (SSyy): Σ (yi – ȳ)2 = Σ yi2 – ((Σ yi)2) ÷ (n)
- Corrected Sum of Cross-Products (SSxy): Σ (xi – x̄)(yi – ȳ) = Σ xi yi – ((Σ xi)(Σ yi)) ÷ (n)
Mathematical Properties of Pearson r
- Bounded Range: -1 ≤ r ≤ +1. A value of exactly +1 indicates a perfect positive linear relationship; a value of -1 indicates a perfect negative linear relationship.
- Zero Correlation: r = 0 indicates the absence of any linear association. It does not prove the absence of an association, as non-linear patterns can also yield r = 0.
- Scale Invariance: Adding, subtracting, multiplying, or dividing either variable by a positive constant leaves r unchanged. Converting a temperature scale from Celsius to Fahrenheit will not alter its correlation with drug reaction rate.
- Symmetry: rxy = ryx. Unlike regression, correlation does not distinguish between explanatory and response variables.
Rule of Thumb for Correlation Strength in Health Sciences
While contextual clinical significance always supersedes arbitrary boundaries, the following conventions are standard in biomedical coursework:
- |r| ≥ 0.80: Very strong linear association
- 0.60 ≤ |r| < 0.80: Moderate to strong linear association
- 0.40 ≤ |r| < 0.60: Fair / moderate linear association
- 0.20 ≤ |r| < 0.40: Weak linear association
- |r| < 0.20: Negligible / very weak linear association
Worked Example 1: Dissolution Assay Rate (Manual Calculation of r)
A quality control pharmacist at a manufacturing facility in Kampala tests an immediate-release amoxicillin 500 mg capsule formulation using USP Dissolution Apparatus II (Paddle method, 100 rpm, phosphate buffer pH 6.8). She samples dissolution time in minutes (X) and measures the percentage of active amoxicillin dissolved (Y) over the first 25 minutes across five sampled timepoints:
Scroll the table sideways to compare
| Timepoint (i) | Time X (min) | Dissolved Y (%) | (xi – x̄) | (yi – ȳ) | (xi – x̄)2 | (yi – ȳ)2 | (xi – x̄)(yi – ȳ) |
|---|---|---|---|---|---|---|---|
| 1 | 5 | 22 | -10 | -38 | 100 | 1444 | 380 |
| 2 | 10 | 41 | -5 | -19 | 25 | 361 | 95 |
| 3 | 15 | 58 | 0 | -2 | 0 | 4 | 0 |
| 4 | 20 | 82 | +5 | +22 | 25 | 484 | 110 |
| 5 | 25 | 97 | +10 | +37 | 100 | 1369 | 370 |
| Sum (Σ) | 75 | 300 | 0 | 0 | 250 | 3662 | 955 |
Step 1: Compute Sample Means:
x̄ = (Σ x) ÷ (n) = (75) ÷ (5) = 15.0 minutes
ȳ = (Σ y) ÷ (n) = (300) ÷ (5) = 60.0%
Step 2: Compute Sums of Squares and Cross-Products:
SSxx = Σ (xi – x̄)2 = 100 + 25 + 0 + 25 + 100 = 250.0
SSyy = Σ (yi – ȳ)2 = 1444 + 361 + 4 + 484 + 1369 = 3662.0
SSxy = Σ (xi – x̄)(yi – ȳ) = 380 + 95 + 0 + 110 + 370 = 955.0
Step 3: Calculate Pearson r:
r = (SSxy) ÷ (√(SSxx · SSyy)) = (955.0) ÷ (√(250.0 × 3662.0)) = (955.0) ÷ (√(915500.0)) = (955.0) ÷ (956.8176) = +0.9981
Pharmacological Interpretation: The sample correlation coefficient of r = +0.998 reveals a near-perfect, direct positive linear relationship between dissolution duration and percentage amoxicillin dissolved over the initial 25-minute test window.
Assumptions, pitfalls & r-squared
Before computing or interpreting Pearson r, ensure the clinical dataset satisfies key statistical criteria:
- Scale of Measurement: Both variables must be continuous quantitative measurements (interval or ratio scale). For ordinal data (such as pain scales or Likert stages), Spearman rank correlation must be used instead.
- Bivariate Normality: For formal hypothesis tests, X and Y should follow a bivariate normal distribution. When plotted, the point cloud should display a roughly elliptical profile. See probability and the normal distribution for pharmacy.
- Linearity: The underlying biological relationship must be straight-line in character.
- Absence of Outliers: Bivariate outliers heavily distort r, pulling it toward +1 or -1, or reducing a genuine correlation to zero.
Crucial Pitfalls in Correlation Analysis
- Correlation Does Not Imply Causation: A high correlation coefficient demonstrates mathematical co-variation, not biological cause-and-effect. For example, monthly sales of sunscreen lotion and cases of community-acquired malaria might correlate positively in a district due to a seasonal confounding variable (rainfall and sunshine patterns), with no direct causal link between sunscreen and plasmodium infection.
- Confounding (The Third-Variable Problem): A lurking variable Z may drive both X and Y. An apparent correlation between coffee intake and coronary artery disease in pharmacy staff often disappears once tobacco smoking status is accounted for.
- Restriction of Range: If a researcher measures drug response over a very narrow range of doses, the calculated correlation will appear weak or negligible even if a strong dose-response exists across the full therapeutic spectrum.
- The Ecological Fallacy: Inferring an individual-level clinical relationship from aggregated population-level data. A correlation observed between national per-capita antibiotic consumption and regional resistance rates does not guarantee that every individual patient taking an antibiotic harbors resistant flora.
The Coefficient of Determination (r2 or R2)
Squaring the correlation coefficient produces the coefficient of determination (r2). Expressed as a proportion or percentage, r2 represents the fraction of total variability in the response variable Y that is explained by its linear relationship with the explanatory variable X:
r2 = (r)2 = (Explained Variation in Y) ÷ (Total Variation in Y)
For our dissolution assay in Worked Example 1, where r = +0.9981:
r2 = (0.9981)2 = 0.9962 (or 99.62%)
This means that 99.62% of the variation in dissolved amoxicillin percentage is explained by dissolution time. Only 0.38% remains unexplained (due to measurement noise, slight temperature fluctuations, or paddle hydrodynamic turbulence).
Worked Example 2: Non-Linearity Pitfall in Pharmacodynamics
A pharmacology researcher evaluates the in vitro binding of a novel synthetic adrenergic agonist to beta-1 cardiac receptors across five drug concentration levels (X, nM) and measures the intracellular cyclic AMP (cAMP) production (Y, pmol/mL). The data points are: (1, 10), (2, 28), (4, 70), (8, 72), (16, 74).
Step 1: Calculate Pearson r on Raw Unmodified Data:
Σ X = 1 + 2 + 4 + 8 + 16 = 31, x̄ = (31) ÷ (5) = 6.2 nM
Σ Y = 10 + 28 + 70 + 72 + 74 = 254, ȳ = (254) ÷ (5) = 50.8 pmol/mL
SSxx = Σ X2 – ((Σ X)2) ÷ (n) = (1 + 4 + 16 + 64 + 256) – (312) ÷ (5) = 341 – 192.2 = 148.8
SSyy = Σ Y2 – ((Σ Y)2) ÷ (n) = (100 + 784 + 4900 + 5184 + 5476) – (2542) ÷ (5) = 16444 – 12903.2 = 3540.8
SSxy = Σ XY – ((Σ X)(Σ Y)) ÷ (n) = (10 + 56 + 280 + 576 + 1184) – (31 × 254) ÷ (5) = 2106 – 1574.8 = 531.2
r = (531.2) ÷ (√(148.8 × 3540.8)) = (531.2) ÷ (√(526871.04)) = (531.2) ÷ (725.8588) = +0.7318
Diagnostic Evaluation of Why Pearson r Is Inappropriate Here:
Although r = +0.732 suggests a “moderate to strong linear relationship,” graphing this dataset reveals a steep initial rise followed by an asymptotic plateau around 72–74 pmol/mL (classic receptor saturation conforming to the Michaelis-Menten / Hill equation). Fitting a straight line to this curve severely misrepresents the true biological behavior: it underestimates response at 4 nM and incorrectly predicts infinite cAMP at higher drug concentrations. The Pearson correlation coefficient fails because the underlying physiological law is non-linear.
The simple linear regression model
While correlation quantifies the direction and strength of mutual association between two variables symmetrically, simple linear regression models the functional mathematical dependence of a response variable Y upon a single explanatory variable X. It allows pharmacists to predict values of Y from known values of X.
The Theoretical Population Model
We postulate that in the broader target population, the true relationship between X and Y is governed by the linear equation:
Yi = β0 + β1 Xi + εi
Where:
- β0 (population intercept): The expected mean value of Y when X = 0.
- β1 (population slope): The true change in the mean value of Y associated with a one-unit increase in X.
- εi (random error or disturbance term): An unobserved random variable accounting for biological variation and measurement imprecision. We assume εi iid ∼ N(0, σ2).
The Sample Fitted Regression Line
Because population parameters β0 and β1 are unknown, we estimate them from sample data to obtain the sample regression equation:
ŷ = b0 + b1 x
Where ŷ denotes the fitted or predicted value of Y, b0 estimates β0, and b1 estimates β1.
The Ordinary Least Squares (OLS) Criterion
For each observed sample point (xi, yi), the vertical distance between the actual observed value yi and the line’s predicted value ŷi is called the residual (ei):
ei = yi – ŷi = yi – (b0 + b1 xi)
The Ordinary Least Squares (OLS) method finds the unique values of b0 and b1 that minimize the sum of squared residuals (Σ ei2):
Minimize S = Σi=1n ei2 = Σi=1n (yi – b0 – b1 xi)2
Applying differential calculus yields the standard OLS formulas:
b1 = (SSxy) ÷ (SSxx) = (Σ (xi – x̄)(yi – ȳ)) ÷ (Σ (xi – x̄)2) = r × ((sy) ÷ (sx))
b0 = ȳ – b1 x̄
Worked Example 3: Deriving the Regression Equation (Clinical Laboratory Biomarker)
A clinical pharmacist at Kiruddu National Referral Hospital monitors renal clearance in patients receiving potentially nephrotoxic intravenous vancomycin. She evaluates serum creatinine concentrations (X, mg/dL) and measured steady-state trough vancomycin concentrations (Y, mg/L) across six patients:
Scroll the table sideways to compare
| Patient (i) | Creatinine X (mg/dL) | Vancomycin Trough Y (mg/L) | X2 | Y2 | X Y |
|---|---|---|---|---|---|
| 1 | 0.8 | 11.0 | 0.64 | 121.0 | 8.80 |
| 2 | 1.0 | 13.5 | 1.00 | 182.25 | 13.50 |
| 3 | 1.2 | 17.0 | 1.44 | 289.0 | 20.40 |
| 4 | 1.5 | 21.0 | 2.25 | 441.0 | 31.50 |
| 5 | 1.8 | 25.5 | 3.24 | 650.25 | 45.90 |
| 6 | 2.1 | 29.0 | 4.41 | 841.0 | 60.90 |
| Total (Σ) | 8.4 | 117.0 | 12.98 | 2524.5 | 181.0 |
Step 1: Compute Sample Means:
x̄ = (Σ x) ÷ (n) = (8.4) ÷ (6) = 1.40 mg/dL
ȳ = (Σ y) ÷ (n) = (117.0) ÷ (6) = 19.50 mg/L
Step 2: Calculate Corrected Sums of Squares (SSxx and SSxy):
SSxx = Σ x2 – ((Σ x)2) ÷ (n) = 12.98 – ((8.4)2) ÷ (6) = 12.98 – (70.56) ÷ (6) = 12.98 – 11.76 = 1.22
SSxy = Σ xy – ((Σ x)(Σ y)) ÷ (n) = 181.0 – (8.4 × 117.0) ÷ (6) = 181.0 – (982.8) ÷ (6) = 181.0 – 163.8 = 17.20
Step 3: Calculate Slope (b1) and Intercept (b0):
b1 = (SSxy) ÷ (SSxx) = (17.20) ÷ (1.22) = +14.0984 ≈ +14.10 mg/L per mg/dL
b0 = ȳ – b1 x̄ = 19.50 – (14.0984 × 1.40) = 19.50 – 19.7377 = -0.2377 ≈ -0.24 mg/L
Step 4: Formulate the Regression Equation:
ŷ = -0.24 + 14.10x or predicted Vancomycin Trough = -0.24 + 14.10(Serum Creatinine)
Practical Interpretation:
- Slope (b1 = +14.10): For every 1.0 mg/dL rise in patient serum creatinine, steady-state trough vancomycin concentration increases on average by 14.10 mg/L, reflecting reduced renal drug elimination.
- Intercept (b0 = -0.24): Mathematically represents the predicted trough concentration when creatinine is 0.0 mg/dL. Biologically, a serum creatinine of zero is incompatible with life, so the intercept acts solely as a geometric anchor for the line within the observed laboratory domain.

Prediction & extrapolation risks
The primary clinical and industrial utility of a fitted regression model is prediction. By substituting a specific value of X (denoted x^*) into our sample regression equation, we compute the point estimate ŷ^*.
Interpolation Versus Extrapolation
- Interpolation: Predicting Y for an x^* value that lies within the range of observed sample data (xmin ≤ x^* ≤ xmax). Interpolation is statistically sound if all regression assumptions are satisfied.
- Extrapolation: Predicting Y for an x^* value that lies outside the observed range (x^* < xmin or x^* > xmax). Extrapolation is hazardous in clinical sciences because there is no statistical guarantee that the straight-line relationship persists outside the observed experimental window.
Worked Example 4: Analytical Assay Prediction & Extrapolation Danger
In a pharmaceutical analysis laboratory at Makerere University, pharmacy students construct an HPLC standard calibration curve for paracetamol by analyzing pure reference standard solutions. The validated calibration curve over concentrations from 2.0 to 20.0 mcg/mL is determined as:
ŷ = 15.2 + 84.5x
Where X is paracetamol concentration in mcg/mL, and Y is the integrated chromatographic peak area (arbitrary detector units, mAU·s).
Scenario A (Valid Interpolation): A reconstituted paediatric paracetamol syrup sample produces a peak area of 1,029.2 mAU·s. What is the estimated concentration (x^*)?
1029.2 = 15.2 + 84.5x^* ⇒ 84.5x^* = 1014.0 ⇒ x^* = (1014.0) ÷ (84.5) = 12.0 mcg/mL
Because 12.0 mcg/mL falls safely within the validated linear range of [2.0, 20.0] mcg/mL, this is a valid interpolation and the analytical result is accepted.
Scenario B (Dangerous Extrapolation): A student attempts to predict the detector peak area for an undiluted tablet extract containing x^* = 60.0 mcg/mL:
ŷ = 15.2 + 84.5(60.0) = 15.2 + 5070.0 = 5085.2 mAU·s

Residual diagnostics & LINE assumptions
For statistical inferences (such as confidence intervals and hypothesis tests) about slope and intercept to be valid, the regression model must satisfy four classical criteria, recalled using the mnemonic LINE.
The “LINE” Assumptions of Linear Regression
- L — Linearity: The relationship between the mean response μY|X and X is truly linear across all observed levels.
- I — Independence: The individual errors (εi) are statistically independent. There is no clustering, serial correlation, or repeated measures without proper model adjustment.
- N — Normality: At any fixed value of X, the distribution of errors εi follows a normal distribution: εi ∼ N(0, σ2).
- E — Equal Variance (Homoscedasticity): The variance of the error terms (σ2) is constant across all levels of X. The spread of data points around the line does not widen or narrow as X increases.
Residual Plots as Primary Diagnostic Tools
The assumptions cannot be verified by looking at the raw Y values alone. Instead, biostatisticians graph the sample residuals (ei = yi – ŷi) on the vertical axis against the fitted values (ŷi) or the predictor (xi) on the horizontal axis.
Scroll the table sideways to compare
| Visual Pattern on Residual Plot | Assumption Violated | Underlying Biological / Assay Cause | Required Remedial Action |
|---|---|---|---|
| Random horizontal rectangular band centered at zero | None (All assumptions met) | Ideal linear behavior; random measurement error | Proceed safely with standard regression inferences |
| Curved, parabolic, or U-shaped pattern | Linearity (L) | Receptor saturation, non-linear pharmacokinetics, or multi-exponential decay | Apply mathematical transformation (e.g., log, reciprocal) or polynomial regression |
| Funnel, wedge, or fan shape (spread widens with X) | Equal Variance / Homoscedasticity (E) | Measurement error scales proportionally with concentration or dose | Use weighted least squares (WLS) or log-transform the response variable |
| Isolated point far from horizontal band | Normality / Outlier | Analytical pipetting error, sample contamination, or patient non-adherence | Investigate for recording error; perform sensitivity analysis with point removed |

Hypothesis testing & confidence intervals
Obtaining a sample slope b1 ≠ 0 does not automatically prove that X and Y are truly related in the wider population. Random sampling variation alone can cause b1 to deviate from zero. As detailed in our foundation on hypothesis testing in biostatistics, we formalize this question with a two-tailed test:
H0: β1 = 0 (No linear relationship between X and Y)
Ha: β1 ≠ 0 (A statistically significant linear relationship exists)
Residual Variance and the Standard Error of the Slope
The sample variance of the regression residuals is termed the residual mean square or residual variance (sy|x2):
sy|x2 = (SSE) ÷ (n – 2) = (Σ (yi – ŷi)2) ÷ (n – 2) = (SSyy – ((SSxy)2) ÷ (SSxx)) ÷ (n – 2)
Where n – 2 represents the degrees of freedom (two degrees of freedom are lost in estimating β0 and β1). The square root, sy|x, is the standard error of the estimate.
The standard error of the slope (SE(b1)) reflects how much b1 fluctuates from sample to sample:
SE(b1) = (sy|x) ÷ (√(SSxx))
The Student’s t-Test for the Slope
Under the null hypothesis H0: β1 = 0, the test statistic follows a Student’s t-distribution with df = n – 2:
t = (b1 – 0) ÷ (SE(b1))
If |t| ≥ tcritical, α/2, df=n-2, we reject the null hypothesis and conclude that the slope is significantly different from zero at significance level α.
Confidence Interval for the Slope (β1)
Following principles from confidence intervals in health research, a (1 – α) × 100% confidence interval for the true population slope β1 is computed as:
β1 ∈ [ b1 – tα/2, n-2 · SE(b1), b1 + tα/2, n-2 · SE(b1) ]
If this interval excludes zero, it confirms a statistically significant linear association between X and Y.
Worked Example 5: Pharmacy Adherence & Glycemic Control in Diabetes
A clinical pharmacy intern at Mulago Specialized National Referral Hospital evaluates medication adherence among 7 type 2 diabetes mellitus patients receiving metformin. Adherence is quantified via Proportion of Days Covered (X, % PDC over 6 months). The clinical response is the observed reduction in Glycated Hemoglobin (Y, ΔHbA1c in percentage points):
Scroll the table sideways to compare
| Patient (i) | Adherence X (%) | ΔHbA1c Y (%) | X2 | Y2 | X Y |
|---|---|---|---|---|---|
| 1 | 50 | 0.4 | 2500 | 0.16 | 20.0 |
| 2 | 60 | 0.7 | 3600 | 0.49 | 42.0 |
| 3 | 70 | 1.0 | 4900 | 1.00 | 70.0 |
| 4 | 75 | 1.2 | 5625 | 1.44 | 90.0 |
| 5 | 80 | 1.4 | 6400 | 1.96 | 112.0 |
| 6 | 90 | 1.8 | 8100 | 3.24 | 162.0 |
| 7 | 95 | 2.0 | 9025 | 4.00 | 190.0 |
| Total (Σ) | 520 | 8.5 | 40150 | 12.29 | 686.0 |
Step 1: Compute Means and Sums of Squares (n = 7):
x̄ = (520) ÷ (7) = 74.2857%, ȳ = (8.5) ÷ (7) = 1.2143%
SSxx = 40150 – (5202) ÷ (7) = 40150 – (270400) ÷ (7) = 40150 – 38628.5714 = 1521.4286
SSyy = 12.29 – (8.52) ÷ (7) = 12.29 – (72.25) ÷ (7) = 12.29 – 10.3214 = 1.9686
SSxy = 686.0 – (520 × 8.5) ÷ (7) = 686.0 – (4420) ÷ (7) = 686.0 – 631.4286 = 54.5714
Step 2: Calculate Slope (b1) and Intercept (b0):
b1 = (SSxy) ÷ (SSxx) = (54.5714) ÷ (1521.4286) = +0.035867 ≈ +0.0359 percentage points HbA1c reduction per 1% adherence
b0 = ȳ – b1 x̄ = 1.2143 – (0.035867 × 74.2857) = 1.2143 – 2.6644 = -1.4501 ≈ -1.45%
ŷ = -1.45 + 0.0359x
Step 3: Compute Residual Sum of Squares (SSE) and Standard Error of Slope:
SSE = SSyy – ((SSxy)2) ÷ (SSxx) = 1.9686 – ((54.5714)2) ÷ (1521.4286) = 1.9686 – (2978.0377) ÷ (1521.4286) = 1.9686 – 1.9574 = 0.0112
sy|x = √((SSE) ÷ (n – 2)) = √((0.0112) ÷ (7 – 2)) = √((0.0112) ÷ (5)) = √(0.00224) = 0.04733
SE(b1) = (sy|x) ÷ (√(SSxx)) = (0.04733) ÷ (√(1521.4286)) = (0.04733) ÷ (39.0055) = 0.001213 (or 0.0012)
Step 4: Conduct Hypothesis Test on Slope (H0: β1 = 0 vs Ha: β1 ≠ 0):
t = (b1) ÷ (SE(b1)) = (0.035867) ÷ (0.001213) = 29.57
For df = n – 2 = 5 at α = 0.05, two-tailed critical t0.025, 5 = 2.571. Because our calculated t = 29.57 > 2.571, we reject H0 (p < 0.001). There is strong evidence that medication adherence is linearly associated with HbA1c reduction.
Step 5: Compute 95% Confidence Interval for Slope:
β1 ∈ 0.03587 ± (2.571 × 0.001213) ⇒ 0.03587 ± 0.00312 ⇒ [0.0328, 0.0390]
We are 95% confident that for every 10% improvement in patient adherence, the true average HbA1c reduction increases by between 0.33% and 0.39%.
Exam-style worked practice problems
Practice Problem 1: Tablet Hardness vs. Disintegration Time
Question: A pharmaceutical formulation laboratory tests five experimental paracetamol tablet batches. The tablet crushing strength (X, in kiloponds, kp) and disintegration time (Y, in seconds) are recorded: (4, 45), (5, 60), (6, 70), (7, 95), (8, 110).
- Calculate the Pearson correlation coefficient (r).
- Calculate and interpret the coefficient of determination (r2).
Step-by-Step Solution:
Σ X = 4 + 5 + 6 + 7 + 8 = 30 ⇒ x̄ = 30 / 5 = 6.0 kp
Σ Y = 45 + 60 + 70 + 95 + 110 = 380 ⇒ ȳ = 380 / 5 = 76.0 s
SSxx = Σ (xi – x̄)2 = (-2)2 + (-1)2 + 02 + 12 + 22 = 4 + 1 + 0 + 1 + 4 = 10.0
SSyy = Σ (yi – ȳ)2 = (-31)2 + (-16)2 + (-6)2 + (19)2 + (34)2 = 961 + 256 + 36 + 361 + 1156 = 2770.0
SSxy = Σ (xi – x̄)(yi – ȳ) = (-2)(-31) + (-1)(-16) + (0)(-6) + (1)(19) + (2)(34) = 62 + 16 + 0 + 19 + 68 = 165.0
r = (SSxy) ÷ (√(SSxx · SSyy)) = (165.0) ÷ (√(10.0 × 2770.0)) = (165.0) ÷ (√(27700.0)) = (165.0) ÷ (166.433) = +0.9914
r2 = (0.9914)2 = 0.9829 (or 98.29%)
Conclusion: There is a very strong, positive linear correlation (r = +0.991) between tablet hardness and disintegration duration. Exactly 98.29% of the variance in disintegration time is explained by tablet crushing strength.
Practice Problem 2: OLS Regression and Spectrophotometric Assay
Question: An analytical chemist generates a 4-point calibration curve for ciprofloxacin at 278 nm. Concentrations (X, mcg/mL) and absorbance units (Y, AU) are: (2, 0.15), (4, 0.31), (6, 0.44), (8, 0.60).
- Derive the least-squares regression line ŷ = b0 + b1 x.
- An unknown capsule sample has an absorbance of 0.38 AU. Predict its ciprofloxacin concentration.
Step-by-Step Solution:
n = 4, Σ X = 20 ⇒ x̄ = 5.0 mcg/mL
Σ Y = 0.15 + 0.31 + 0.44 + 0.60 = 1.50 ⇒ ȳ = 0.375 AU
SSxx = (22 + 42 + 62 + 82) – (202) ÷ (4) = (4 + 16 + 36 + 64) – (400) ÷ (4) = 120 – 100 = 20.0
Σ XY = (2 × 0.15) + (4 × 0.31) + (6 × 0.44) + (8 × 0.60) = 0.30 + 1.24 + 2.64 + 4.80 = 8.98
SSxy = 8.98 – (20 × 1.50) ÷ (4) = 8.98 – 7.50 = 1.48
b1 = (SSxy) ÷ (SSxx) = (1.48) ÷ (20.0) = 0.0740 AU per mcg/mL
b0 = ȳ – b1 x̄ = 0.375 – (0.0740 × 5.0) = 0.375 – 0.370 = +0.0050 AU
ŷ = 0.0050 + 0.0740x
For an unknown absorbance ŷ = 0.38 AU:
0.38 = 0.0050 + 0.0740x^* ⇒ 0.0740x^* = 0.375 ⇒ x^* = (0.375) ÷ (0.0740) = 5.068 mcg/mL
Conclusion: The regression equation is ŷ = 0.0050 + 0.0740x. The predicted drug concentration is 5.07 mcg/mL, which is a reliable interpolation lying within the experimental calibration domain [2, 8] mcg/mL.
Practice Problem 3: Regression Diagnostics and Extrapolation
Question: An industrial stability trial stores reconstituted ampicillin oral suspension at 25^°C over 14 days. The concentration of active intact ampicillin (Y, mg/mL) is modeled against storage days (X). A student reports: ŷ = 250 – 15x, with r = -0.92, based on data from Day 0 through Day 10. The student predicts that on Day 20, the suspension will have a concentration of -50 mg/mL. Identify two major statistical errors in this student’s reporting.
Step-by-Step Solution:
- Severe Extrapolation Error: The student predicted drug concentration at Day 20, which is double the maximum observed timepoint of Day 10 (xmax = 10). Linear models cannot be projected outward without proof of continued linearity.
- Biological Impossibility (Nonsense Intercept/Domain): The regression line predicts a negative concentration (-50 mg/mL), which is physically impossible. Drug degradation typically follows first-order or zero-order kinetics that asymptote toward zero. The linear model violates the physical nature of the reaction outside the initial window.
Conclusion: The student committed invalid extrapolation and failed to recognize that chemical degradation curves must be modeled with exponential decay models rather than unconstrained simple linear regression.
Summary & verified references
Verified References & Academic Reading
- Cornell University Quantitative Biology: Banfelder, J. (2009). Correlation and Linear Regression. Resource Lecture Notes. Verified document: Cornell Medical College Bio-Resources (opens new tab).
- Johns Hopkins Institute for Clinical and Translational Research: Yenokyan, G. (2014). Introduction to Linear Regression. Biostatistics Core Curriculum. Verified document: JHU ICTR Biostatistics Lecture Series (opens new tab).
- University of Massachusetts Amherst: Stanek, E. & Sullivan, L. (2022). Simple Linear Regression: Course Notes BIEP 540W. Department of Biostatistics and Epidemiology. Verified document: UMass Public Health Biostatistics Notes (opens new tab).
- Foundational Biomedical Text: Daniel, W. W. & Cross, C. L. (2018). Biostatistics: A Foundation for Analysis in the Health Sciences (11th ed.). Wiley. Chapters 9 & 10: Simple Linear Regression and Correlation.