STA 264 · Statistics for Biological and Agricultural Sciences
Our notes
2 min readRegression or correlation?
- Correlation: how strongly two variables move together.
- Regression: a line to predict y from x, as when yield depends on the fertiliser rate.
Useful sums
Sxx = Σx² − (Σx)²/n
Syy = Σy² − (Σy)²/n
Sxy = Σxy − (Σx)(Σy)/n
Correlation coefficient
r = Sxy ÷ √(Sxx × Syy), with −1 ≤ r ≤ 1.
- Close to +1: strong positive straight-line pattern
- Close to −1: strong negative
- Close to 0: no straight-line pattern (a curved one may still exist)
Regression line
y = a + bx, where b = Sxy/Sxx and a = ȳ − bx̄.
Worked example
Nitrogen rate x (bags/ha) and maize yield y (t/ha):
| x | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| y | 2 | 3 | 5 | 4 | 6 |
n = 5; Σx = 15; Σy = 20; Σx² = 55; Σy² = 90; Σxy = 2 + 6 + 15 + 16 + 30 = 69.
- Sxx = 55 − 45 = 10
- Syy = 90 − 80 = 10
- Sxy = 69 − 60 = 9
- r = 9/√100 = 0.90
- b = 9/10 = 0.9
- a = 4 − 0.9(3) = 1.3
Line: y = 1.3 + 0.9x. Each extra bag adds 0.9 t/ha, in this range.
Check: the line must pass through (x̄, ȳ) = (3, 4): 1.3 + 2.7 = 4. Correct.
Coefficient of determination
r² = 0.81: 81% of the variation in yield goes with x in this data set.
Testing the slope
Residual SS = Syy − b Sxy = 10 − 8.1 = 1.9.
s² = 1.9/(n − 2) = 1.9/3 = 0.633.
SE(b) = √(s²/Sxx) = √0.0633 = 0.252.
t = 0.9/0.252 = 3.58. The critical value with df 3 is 3.182, so the slope is significant at 5%.
Check using r: t = r√(n − 2)/√(1 − r²) = 0.9 × 1.732/0.436 = 3.58. Correct.
Predicting
At x = 3.5: y = 1.3 + 3.15 = 4.45 t/ha.
Interpolation (within the data) is safer than extrapolation. At x = 20 the line gives 19.3 t/ha, which is absurd: yield flattens out, then falls. Biological responses often level off, so don't trust a straight line outside the range.
Residuals
Residual = observed − predicted. Plot them. A pattern shows the straight line doesn't fit.
Curves made straight
Some relationships become lines after a transformation.
- Growth: ln y on x
- Dose-response: often using log dose
- Length-weight in fish: W = aLᵇ becomes log W = log a + b log L
Correlation is not causation
Lurking variables can explain a pattern. Rainfall could raise both weed cover and crop yield, so weeds and yield would be correlated without weeds helping yield. To show cause, run a designed, randomised experiment.
Spearman's rank correlation
For ranks or data that aren't normal: r_s = 1 − 6Σd²/[n(n² − 1)], where d is the difference in ranks.
Exams usually ask: compute r and the regression line; predict y; test the slope; interpret r²; explain why correlation doesn't prove cause.
Common mistake: swapping x and y. The regression of y on x is not the same line as x on y, unless r = ±1.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Best pick Introductory Statistics 2e, 12.3 The Regression Equation
(opens openstax.org in a new tab)
OpenStax, Introductory Statistics 2e, 12.3 The Regression Equation, CC BY-NC-SA 4.0 · licence
-
Simple linear regression
(opens en.wikipedia.org in a new tab)
Wikipedia, Simple linear regression, CC BY-SA 4.0 · licence
-
Pearson correlation coefficient
(opens en.wikipedia.org in a new tab)
Wikipedia, Pearson correlation coefficient, CC BY-SA 4.0 · licence
-
OpenStax, Introductory Statistics 2e (whole free textbook)
The whole book, free to read online or download as a PDF (the PDF is large: Wi-Fi).
(opens openstax.org in a new tab)
OpenStax, OpenStax, Introductory Statistics 2e (whole free textbook), CC BY-NC-SA 4.0 · licence
-
NOUN STT 206: Statistics for Management Sciences II
NOUN course book (PDF, about 3.2 MB). Estimation, tests and regression.
(opens nou.edu.ng in a new tab)
Watch
-
Correlation and Regression Lines - Year 1 Statistics [A-level]
23 min · ≈ 104 MB · about ₦58
(opens youtube.com in a new tab)
-
Linear Regression Using Least Squares Method - Line of Best Fit Equation
15 min · ≈ 68 MB · about ₦38
(opens youtube.com in a new tab)
-
Linear Regression in Statistics Explained
20 min · ≈ 90 MB · about ₦51
(opens youtube.com in a new tab)
-
Online Lecture on Correlation and Regression Analysis
1 h 54 min · ≈ 513 MB · about ₦288
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.