In geostatistical analysis the mean function of the spatial process is specified by a parametric model, \(\mu(s; \beta)\). The most commonly used parametric mean model is a linear function, given by

\[\mu(\mathbf{s}; \mathbf{\beta}) = \mathbf X(s)^T\mathbf{\beta}\]

where \(X(s)\) is a vector of covariates (explanatory variables) observed at \(s\), and \(\mathbf{\beta}\) is a parameter vector. The covariates may also include the geographic coordinates (e.g., latitude and longitude) of \(s\), mathematical functions (such as polynomials) of those coordinates, and attribute variables.

The standard method for fitting a provisional linear mean function to geostatistical data is ordinary least squares (OLS). This method yields the OLS estimator \(\hat{\beta}_{OLS}\) of \(\beta\), given by

\[\hat{\beta}_{OLS} = \text{argmin} \sum_{i=1}^n[Z(\mathbf s_i) -\mathbf X(\mathbf s_i)^T\mathbf{\beta}]^2 \]

Fitted values and fitted residuals at data locations are given by \(\hat z = \mathbf{X^T}\mathbf{\hat{\beta}}_{OLS}\) and \(\hat e= z-\hat z\), respectively. The latter are passed to the second stage of the geostatistical analysis, to be described in the next section.