1  Introduction to Regression Analysis

Regression analysis is a set of statistical methods for studying how a variable of interest, the response, changes when one or more other variables, the regressors, change (Draper and Smith 1998; Montgomery, Peck, and Vining 2021). A soil scientist relating grain yield to applied nitrogen, an agrometeorologist predicting coconut yield from rainfall of the previous two years, and a plant breeder relating seed yield to its components are all doing regression analysis.

Regression serves three purposes, which are often combined in one study:

  1. Description: summarizing how the mean response changes with the regressors, for example “grain yield increases by 15 kg/ha for every additional kg of N”.
  2. Prediction: estimating the response for new values of the regressors, for example forecasting district yield from weather variables before harvest.
  3. Control and optimization: choosing values of the regressors that achieve a desired response, for example finding the nitrogen dose that maximizes profit (Chapter 13).

1.1 Functional and statistical relationships

A functional (deterministic) relationship is exact: the area of a square plot is the square of its side, \(A=s^2\), and every plot with side \(s\) has exactly this area. A statistical relationship is not exact. Two plots receiving the same nitrogen dose do not give the same yield, because yield is also affected by soil heterogeneity, pests, microclimate and many small causes that the experimenter does not control.

A statistical relationship is therefore written as

\[\text{response} = \text{systematic part} + \text{random part},\]

\[y = f(x_1,x_2,\ldots,x_k;\ \beta_0,\beta_1,\ldots) + \varepsilon \tag{1.1}\]

where \(f(\cdot)\) is the regression function (the mean of \(y\) for given values of the \(x\)’s), \(\beta_0,\beta_1,\ldots\) are unknown constants called parameters or regression coefficients, and \(\varepsilon\) is a random error representing all the variation not explained by the regressors.

1.2 Variables in a regression model

  • Response variable (\(y\)): also called the dependent variable, study variable, explained variable, regressand or outcome. It is treated as random.
  • Regressors (\(x_1,\ldots,x_k\)): also called independent variables, explanatory variables, predictors or covariates. In classical regression they are treated as fixed (non-random) constants measured without error. In a field experiment the nitrogen levels are fixed by the experimenter, so this assumption holds exactly. In an observational study (for example a farm survey) the regressors are themselves random, and the analysis is then carried out conditionally on the observed values of the regressors.
Note

The words “dependent” and “independent” do not mean that the regressors are statistically independent of each other. In most agricultural data the regressors are correlated among themselves (for example rainfall and relative humidity, or tiller number and productive tiller number). The consequences of such correlation are studied in Chapter 11.

1.3 Linear and nonlinear models

A regression model is called linear when it is linear in the parameters, not necessarily in the regressors. The following are all linear models:

\[y=\beta_0+\beta_1x+\varepsilon, \qquad y=\beta_0+\beta_1x+\beta_2x^2+\varepsilon, \qquad y=\beta_0+\beta_1\log x+\beta_2 x_2+\varepsilon\]

because each parameter enters as a simple multiplier of a known quantity. The model

\[y=\frac{\alpha}{1+e^{-(x-\gamma)/\delta}}+\varepsilon\]

is nonlinear, because the parameters \(\gamma\) and \(\delta\) appear inside a nonlinear function. Some nonlinear models can be made linear by a transformation (for example \(y=\alpha e^{\beta x}\varepsilon\) becomes \(\ln y=\ln\alpha+\beta x+\ln\varepsilon\)); these are called intrinsically linear. Others cannot, and are called intrinsically nonlinear (Chapter 17).

Table 1.1: Classification of regression models used in this book
Model Form Chapter
Simple linear \(y=\beta_0+\beta_1x+\varepsilon\) Chapter 3
Multiple linear \(y=\beta_0+\beta_1x_1+\cdots+\beta_kx_k+\varepsilon\) Chapter 4
Polynomial \(y=\beta_0+\beta_1x+\beta_2x^2+\cdots+\varepsilon\) Chapter 13
With indicator variables \(y=\beta_0+\beta_1x+\gamma D+\varepsilon\), \(D\in\{0,1\}\) Chapter 14
Weighted \(V(\varepsilon_i)=\sigma^2/w_i\) Chapter 12
Nonlinear \(y=f(x;\boldsymbol\theta)+\varepsilon\) Chapter 17

1.4 The general linear model

With \(n\) observations and \(k\) regressors, the multiple linear regression model is

\[y_i=\beta_0+\beta_1x_{i1}+\beta_2x_{i2}+\cdots+\beta_kx_{ik}+\varepsilon_i,\qquad i=1,2,\ldots,n. \tag{1.2}\]

Writing the \(n\) equations together in matrix form gives

\[\underset{n\times1}{\mathbf{y}}=\underset{n\times p}{\mathbf{X}}\ \underset{p\times1}{\boldsymbol\beta}+\underset{n\times1}{\boldsymbol\varepsilon},\qquad p=k+1, \tag{1.3}\]

where

\[\mathbf{y}=\begin{bmatrix}y_1\\y_2\\\vdots\\y_n\end{bmatrix},\quad \mathbf{X}=\begin{bmatrix}1&x_{11}&\cdots&x_{1k}\\1&x_{21}&\cdots&x_{2k}\\\vdots&\vdots&&\vdots\\1&x_{n1}&\cdots&x_{nk}\end{bmatrix},\quad \boldsymbol\beta=\begin{bmatrix}\beta_0\\\beta_1\\\vdots\\\beta_k\end{bmatrix},\quad \boldsymbol\varepsilon=\begin{bmatrix}\varepsilon_1\\\varepsilon_2\\\vdots\\\varepsilon_n\end{bmatrix}.\]

The matrix \(\mathbf{X}\) is called the design matrix or model matrix. Its first column of ones carries the intercept \(\beta_0\). Throughout this book \(p\) denotes the number of parameters (columns of \(\mathbf X\)) and \(k=p-1\) the number of regressors.

1.5 Assumptions of the classical linear regression model

The standard results of regression rest on the following assumptions:

  1. Correct form: the mean of \(y\) is linear in the parameters, \(E(\mathbf y)=\mathbf X\boldsymbol\beta\), so \(E(\boldsymbol\varepsilon)=\mathbf 0\).
  2. Constant variance (homoscedasticity): \(V(\varepsilon_i)=\sigma^2\) for all \(i\).
  3. Uncorrelated errors: \(Cov(\varepsilon_i,\varepsilon_j)=0\) for \(i\neq j\). Assumptions 2 and 3 together are written \(D(\boldsymbol\varepsilon)=E(\boldsymbol\varepsilon\boldsymbol\varepsilon')=\sigma^2\mathbf I_n\).
  4. Full rank: the regressors are fixed and \(\mathbf X\) has full column rank \(p\), so that \((\mathbf X'\mathbf X)^{-1}\) exists. This requires \(n>p\) and no exact linear relation among the columns of \(\mathbf X\).
  5. Normality (needed only for exact tests and confidence intervals): \(\boldsymbol\varepsilon\sim N_n(\mathbf 0,\sigma^2\mathbf I_n)\).
Table 1.2: Assumptions, how they fail and where they are examined
Assumption Typical failure in agricultural data Examined in
Correct functional form Diminishing returns to fertilizer Chapter 8, Chapter 13
Constant variance Spread of expenditure grows with farm size Chapter 12
Uncorrelated errors Yields in successive years Chapter 10
Full rank / no collinearity Tillers and productive tillers Chapter 11
Normality Count data, skewed pest incidence Chapter 8, Chapter 12
No unusual observations Data entry errors, unusual farms Chapter 9, Chapter 16

1.6 Steps in regression model building

A regression analysis is not a single computation but an iterative process:

  1. State the objective and identify the response and candidate regressors from subject-matter knowledge.
  2. Explore the data: scatter plots, correlation matrix, summary statistics.
  3. Specify a model: choose its form (linear, polynomial, nonlinear) and the regressors.
  4. Estimate the parameters by least squares or maximum likelihood (Chapter 4, Chapter 5).
  5. Test the model: overall \(F\) test, tests of individual coefficients, \(R^2\) (Chapter 7).
  6. Check the assumptions with residuals and influence measures (Chapter 8, Chapter 9).
  7. Remedy any problem found (transformation, weighting, adding terms, robust fitting) and return to step 4.
  8. Validate and use the model for description, prediction or optimization, within the range of the data.
Note

Regression does not prove causation. A significant regression of yield on the number of tractors in a district does not mean that tractors raise yield; both may increase with irrigation. Causal statements require designed experiments, in which the regressor values are assigned at random, or strong subject-matter arguments. Equally, a fitted model should not be used to predict far outside the range of the observed regressors (extrapolation), because the form of the relation there is unknown.

1.7 Regression in agricultural research

  • Response curves: yield response to fertilizer, irrigation, plant density or seed rate, used to recommend economic doses.
  • Crop–weather models: yield forecasting from rainfall, temperature and sunshine.
  • Yield component analysis: relating yield to tillers, grains per panicle and test weight; the basis of path analysis.
  • Growth analysis: logistic and Gompertz curves for dry matter, leaf area and fruit growth.
  • Calibration: relating a quick laboratory measurement (chlorophyll meter reading) to a slow one (leaf N content).
  • Economics: production functions (Cobb–Douglas), demand and supply functions, price forecasting.
  • Experimental design: analysis of covariance and response surface methods are regression models in disguise.

1.8 Notation used in this book

Table 1.3: Notation
Symbol Meaning
\(n\) number of observations
\(k\) number of regressors
\(p=k+1\) number of parameters including the intercept
\(\mathbf y\), \(\mathbf X\), \(\boldsymbol\beta\), \(\boldsymbol\varepsilon\) response vector, design matrix, parameter vector, error vector
\(\hat{\boldsymbol\beta}\) or \(\mathbf b\) least squares estimate of \(\boldsymbol\beta\)
\(\hat{\mathbf y}=\mathbf X\hat{\boldsymbol\beta}\) fitted values
\(\mathbf e=\mathbf y-\hat{\mathbf y}\) residuals
\(\mathbf H=\mathbf X(\mathbf X'\mathbf X)^{-1}\mathbf X'\) hat matrix; \(h_{ii}\) its diagonal elements
\(SS_T\), \(SS_R\), \(SS_{Res}\) total, regression and residual sums of squares
\(MS_{Res}=s^2=\hat\sigma^2\) residual mean square
\(C_{jj}\) \(j\)th diagonal element of \((\mathbf X'\mathbf X)^{-1}\)
Historical Insights

From comets to sweet peas

The method of least squares was first published by Adrien-Marie Legendre in 1805 as an appendix to a work on the orbits of comets (Legendre 1805). Carl Friedrich Gauss published it in 1809, claiming he had used it since 1795, and connected it with the normal distribution of errors (Gauss 1809). The word regression, however, comes from biology. Francis Galton, studying the sizes of sweet pea seeds and later human stature, found that offspring of unusually large parents were on average less extreme than their parents, a phenomenon he called “regression towards mediocrity” (Galton 1886). Karl Pearson gave the theory its mathematical form (Pearson 1896), and R. A. Fisher, working on the Broadbalk wheat data at Rothamsted, made regression a central tool of agricultural research (Fisher 1921).

Quotes to Inspire

“All models are wrong, but some are useful.”
- George E. P. Box

1.9 Chapter Summary

Fill in the blanks

Answers are given at the end of the chapter.

  1. The variable whose mean is modelled in regression is called the __________ variable.

  2. A model that is linear in the __________ is called a linear model, even if it contains \(x^2\).

  3. A nonlinear model that can be converted into a linear one by transformation is called intrinsically __________.

  4. In \(\mathbf y=\mathbf X\boldsymbol\beta+\boldsymbol\varepsilon\), the matrix \(\mathbf X\) is called the __________ matrix.

  5. The assumption \(V(\varepsilon_i)=\sigma^2\) for all \(i\) is called __________.

  6. The assumptions of constant variance and uncorrelated errors are written together as \(D(\boldsymbol\varepsilon)=\) __________.

  7. If \(\mathbf X\) has \(p\) columns and full column rank, the matrix __________ is invertible.

  8. Predicting the response outside the range of the observed regressors is called __________.

  9. The term “regression” was introduced by __________.

  10. The method of least squares was first published by __________ in 1805.

Short-answer questions

  1. Distinguish between a functional and a statistical relationship with an agricultural example.

  2. State the three main purposes of regression analysis.

  3. Why is \(y=\beta_0+\beta_1x+\beta_2x^2+\varepsilon\) called a linear model?

  4. Distinguish between intrinsically linear and intrinsically nonlinear models.

  5. Write the multiple linear regression model in matrix form and state the order of each matrix.

  6. List the assumptions of the classical linear regression model.

  7. Which assumption is needed only for tests and confidence intervals?

  8. Why must \(n\) be greater than \(p\)?

  9. Explain why regression does not establish causation.

  10. List the steps in building a regression model.

Numerical and conceptual questions

Answers are given at the end of the chapter.

  1. A model has an intercept and four regressors fitted to 20 observations. Find \(n\), \(k\) and \(p\) and the order of \(\mathbf X\).

  2. Classify each model as linear, intrinsically linear or intrinsically nonlinear: (a) \(y=\beta_0+\beta_1\sqrt{x}+\varepsilon\); (b) \(y=\alpha x^\beta\varepsilon\); (c) \(y=\alpha(1-e^{-\beta x})+\varepsilon\).

  3. Linearize \(y=\alpha e^{\beta x}\varepsilon\).

  4. A design matrix has columns \(\mathbf 1\), \(\mathbf x_1\), \(\mathbf x_2\) and \(\mathbf x_3=\mathbf x_1+\mathbf x_2\). What is its rank and what problem arises?

  5. A regression of district rice yield on the number of soil testing laboratories is significant. Can we conclude that laboratories raise yield? Explain.

Important formulae

General statistical model:

\[ y=f(x_1,\ldots,x_k;\boldsymbol\beta)+\varepsilon \]

Multiple linear regression model:

\[ y_i=\beta_0+\beta_1x_{i1}+\cdots+\beta_kx_{ik}+\varepsilon_i \]

Matrix form:

\[ \mathbf y=\mathbf X\boldsymbol\beta+\boldsymbol\varepsilon,\qquad E(\boldsymbol\varepsilon)=\mathbf 0,\qquad D(\boldsymbol\varepsilon)=\sigma^2\mathbf I_n \]

Quick revision

  • Regression → models the mean of a response as a function of regressors.
  • Linear model → linear in parameters, not necessarily in \(x\).
  • \(\mathbf y=\mathbf X\boldsymbol\beta+\boldsymbol\varepsilon\) → \(n\) observations, \(p=k+1\) parameters.
  • Assumptions → correct form, constant variance, uncorrelated errors, full rank, normality.
  • Regression ≠ causation; avoid extrapolation.
  • Model building is iterative → specify, estimate, test, diagnose, remedy.

Answers to fill in the blanks

1. Response (dependent) 2. Parameters 3. Linear 4. Design (model) 5. Homoscedasticity 6. \(\sigma^2\mathbf I_n\) 7. \(\mathbf X'\mathbf X\) 8. Extrapolation 9. Francis Galton 10. Legendre

Solutions to numerical and conceptual questions

  1. \(n=20\), \(k=4\), \(p=5\); \(\mathbf X\) is \(20\times5\) (Equation 1.3).

    1. Linear, since \(\sqrt x\) is a known function; (b) intrinsically linear, \(\ln y=\ln\alpha+\beta\ln x+\ln\varepsilon\); (c) intrinsically nonlinear because the error is additive.
  2. \(\ln y=\ln\alpha+\beta x+\ln\varepsilon\), a simple linear regression of \(\ln y\) on \(x\) with intercept \(\ln\alpha\).

  3. Rank is 3, not 4, because one column is a linear combination of others; \(\mathbf X'\mathbf X\) is singular and \(\boldsymbol\beta\) cannot be uniquely estimated (perfect multicollinearity).

  4. No. The relation is observational; both variables may increase with a third factor (development, irrigation). Regression alone does not establish causation.