Comparing Spatial Regression to Random Forests for Large Environmental Data Sets
Eric W. Fox Jay M. Ver Hoef Anthony R. Olsen


Title:  Comparing Spatial Regression to Random Forests for Large Environmental Data Sets


Authors: Eric W. Fox^1, Jay M. Ver Hoef^2, and Anthony R. Olsen^3



^1California State University East Bay, Department of Statistics and Biostatistics, Hayward, CA 94542.

Email: eric.fox@csueastbay.edu


^2National Marine Mammal Laboratory, Alaska Fisheries Science Center, National Oceanic and Atmospheric Administration, Seattle, WA 98115.


^3National Health and Environmental Effects Research Laboratory, Western Ecology Division, U.S. Environmental Protection Agency, Corvallis, OR 97333.



Environmental data may be “large" due to number of records, number of covariates, or both.  Random forests has a reputation for good predictive performance when using many covariates with nonlinear relationships, whereas spatial regression, when using reduced rank methods, has a reputation for good predictive performance when using many records that are spatially autocorrelated.  In this study, we compare these two techniques using a data set containing the macroinvertebrate multimetric index (MMI) at 1859 stream sites with over 200 landscape covariates.  A primary application is mapping MMI predictions and prediction errors at 1.1 million perennial stream reaches across the conterminous United States.  For the spatial regression model, we develop a novel transformation procedure that estimates Box-Cox transformations to linearize covariate relationships and handles possibly zero-inflated covariates. We find that the spatial regression model with transformations, and a subsequent selection of significant covariates, has cross-validation performance slightly better than random forests.  We also find that prediction interval coverage is close to nominal for each method, but that spatial regression prediction intervals tend to be narrower and have less variability than quantile regression forest prediction intervals.  A simulation study is used to generalize results and clarify advantages of each modeling approach.




Key Words:  Spatial regression; Random forests; Geostatistics; National Rivers and Streams Assessment




§ INTRODUCTION


As we enter the age of “big data” <cit.>, innovative statistical methods are required for insights from massive data sets <cit.>.  While big data is an abstract concept <cit.>, data for a statistical analysis are generally prepared as tables, with records down the rows, and variables across the columns <cit.>. While we immediately recognize big data problems for large numbers of records, there are also issues when there are large numbers of columns <cit.>.  We are interested in a spatial data set in the United States of national importance based on an aquatic health index, where there are thousands of rows and hundreds of columns.  Two leading candidates for analyzing such data are random forests (), because it handles large numbers of covariates with nonlinear relationships, and spatial regression <cit.>, because it accounts for possible spatial autocorrelation.  The ultimate goal of the analysis is to predict the aquatic health index at over one million watersheds throughout the country, while also gaining some understanding of which covariates are important.  The goal of this article is to use best practices for analyzing the data with spatial regression and random forests, and then compare the methods.



 §.§ Motivating Data Set
 
For this study, we use a data set containing the biological condition of n=1859 sites from the US Environmental Protection Agency's 2008/09 National Rivers and Streams Assessment (NRSA; ).  The NRSA used a generalized random-tessellation design <cit.> to collect a spatially-balanced and representative sample of stream sites across the conterminous US (CONUS).  The target population for the design consisted of all rivers and streams within the CONUS that had flowing water during the study period, which extended between April to September of 2008/09.  Benthic macroinverabrates (e.g., aquatic insects, crustaceans, and worms) were sampled to determine the biological condition of stream sites.  A multimetric index (MMI)  was developed for the NRSA to summarize several measures of the condition of macroinvertebrate assemblages (e.g., taxonomic composition, diversity, tolerance to disturbance, etc.) into a combined index.  The reported MMI values were calculated by summing six individual measures, or `metrics', and then normalized to a 0-100 scale <cit.>.  The individual metrics used for the MMI were selected separately for each of the nine ecoregions <cit.> to account for some of the natural variation in climate, geology, hydrology and soils among stream sites.  The ecoregion boundaries and locations of the 2008/09 NRSA stream sites are shown in Figure <ref>.  A comprehensive description of the MMI developed for the NRSA was provided by <cit.>, <cit.>, and <cit.>.

For modeling the MMI we use a large suite of p=209 covariates from the Stream-Catchment (StreamCat) data set (; publicly available at <https://www.epa.gov/national-aquatic-resource-surveys/streamcat>).  StreamCat contains upstream landscape features (e.g., topograpy, precipitation, landscape imperviousness, urban and agricultural land use) for 2.6 million stream reaches across the CONUS and allows for spatially explicit prediction.  The variables in StreamCat can be linked to the National Hydrography Dataset Plus Version 2 (NHDPlusV2; ) and are available at two spatial scales: local catchment and full contributing watershed.  <cit.> defines a “catchment" as the local drainage area for an individual NHDPlusV2 stream segement, excluding upstream drainage area; and a “watershed" as the set of hydrologically connected catchments that contribute flow to a given catchment (i.e., catchment plus upstream catchments).  Note that we only make MMI predictions for the 1.1 million perennial stream reaches (as designated in NHDPlusV2) since the sample frame for the NRSA is limited to these types of streams. Descriptions of StreamCat covariates used in this study are provided in the Supplement.



 §.§ Literature Review
 

There have been surprisingly few attempts to compare random forests and spatial regression. Most found random forests superior to various forms of linear regression with autocorrelated errors <cit.>, although <cit.>, and <cit.> found spatial regression outperformed random forests.  All comparisons used either root-mean-squared prediction error (RMSPE) or mean absolute prediction error (MAPE) on some form of n-fold cross-validation, and only <cit.> evaluated the estimated prediction errors to examine whether prediction intervals contained the true values with the correct proportion.  None of the papers simulated spatially autocorrelated data to evaluate and compare the different modeling approaches.

The comparisons in our review used random forests and spatial regression mostly as black box methods.  By black box methods, we mean that data are used without much examination, and methods that rely on default values and little user interaction.  Generally, random forests seems to outperform spatial regression, but only as a black box method.  Can practitioners with more experience make each of these methods work better, and then how will they compare?  It will be (or should be) rare that data, collected at great expense, are subjected to black box methods.  The history of regression has taught statisticians to use best practices for their data analyses, including exploring data, making transformations, checking residuals, using model diagnostics, and then possibly refitting models.  We suggest that the results given in the previously mentioned literature are not necessarily reflective of a considered approach to many data analyses.  In contrast, we will confine ourselves to a single data set, and a single response variable, but we take considerable effort to make each method work as well as possible, and discuss the ramifications after the analyses.  We will also use simulations to investigate properties not seen in the real data.

Our objectives are to compare random forest and spatial regression modeling approaches for predicting and mapping the MMI for all 1.1 million perennial stream reaches across the CONUS.  In a related study, <cit.> used random forest modeling to predict the binary “good" and “poor" MMI condition classes with StreamCat predictor variables.  The random forest models developed in <cit.> were used to map the predicted probability of good stream condition for all perennial CONUS stream reaches.  In this article we instead model the MMI scores directly, and include both random forests and spatial regression.  We also evaluate each method's ability to quantify the uncertainty of the MMI predictions.  Previous studies have produced maps of random forest model uncertainties by interpolating the residuals <cit.>, or taking the standard deviations of the predictions made by each tree in the ensemble <cit.>.  In this article we take a different approach, and formally construct random forest prediction intervals using the method of quantile regression forests <cit.>,  which has been studied primarily in the context of non-spatial data.  We also consider a hybrid random forest regression-kriging approach, in which a simple-kriging model is estimated for the random forest residuals, and simple-kriging predictions of residuals are added to random forest predictions.  Although we focus on a particular data set, we generalize the concepts through simulations, and our overall goal is application to other large environmental data sets.



§ SPATIAL REGRESSION MODEL
 
Here, we introduce the spatial regression model, likelihood-based estimation methods, and kriging prediction and variance equations that we apply to the MMI and StreamCat data.  The reduced rank method, and covariate transformation and selection procedures will be discussed in subsequent sections. A thorough review of the geostatistical modeling approach discussed in this study is provided in <cit.> and  <cit.>.

Suppose that Y = (Y(s_1), ⋯, Y(s_n))' is a response vector that is spatially referenced at locations s_i ∈ D ⊂ℝ^2. The spatial regression model can be written as


    Y = Xβ + z + ϵ,


where X is an n × p design matrix for the covariates, β is a p × 1 vector of unknown regression coefficients, z is an n × 1 vector of spatially autocorrelated random variables, and ϵ is an n × 1 vector of independent random errors.  The n × n covariance matrix for the model can be expressed as


    Σ = (Y) = (z) + (ϵ) = R + σ^2_ϵI.


To simplify estimation of (<ref>), we assume a stationary covariance function that depends on Euclidean distance and takes an exponential form.  That is, the (i,j) entry of R is given by


    (z(s_i), z(s_j)) = σ^2_z exp(-‖s_i - s_j ‖/α),


where  ‖·‖ denotes the Euclidean distance metric, and σ^2_z and α are parameters to be estimated. In the geostatistical literature, the parameters σ^2_z, α, and σ^2_ϵ are, respectively, called the partial sill, range, and nugget.  The nugget parameter models residual variation in the response when the separating distance is zero.

Model (<ref>) is also commonly referred to as the spatial linear model (SLM), and as the universal-kriging model when used for spatial prediction, with the ordinary-kriging model being the special case when X is a n × 1 column vector of 1's.  While numerous types of covariance functions have been proposed for the SLM (e.g., , pp. 80–93), we only consider the exponential form in (<ref>) since estimation of the SLM is computationally demanding with large data sets.  Moreover, for modeling MMI, we focus instead on estimating covariate transformations in X, which are discussed subsequently in Section <ref>.  Regionally varying intercept terms are also included in X to account for differences in MMI development in the nine ecoregions.

The parameters of a spatial regression model for a particular data set can be estimated using maximum likelihood (ML; , p. 92) or restricted maximum likelihood (REML; ; ) estimation.  The negative log-likelihood can be expressed as


    l(β, θ) =  0.5 {n log(2 π) + log(|Σ(θ)|) +
    (Y - Xβ)' Σ(θ)^-1 (Y - Xβ) + c},


where, for ML, c=0, and for REML, c=-plog(2π) + log |X' Σ(θ)^-1X|; the covariance matrix, Σ(θ), is written here to emphasize dependence on the unknown covariance parameters θ (i.e., nugget, partial sill, and range).  Minimizing (<ref>) with respect to β gives


    β̂(θ) = (X'Σ(θ)^-1X)^-1X' Σ(θ)^-1Y.


The ML or REML estimators of the covariance parameters, θ̂, are obtained by substituting β̂(θ) into (<ref>) and minimizing with respect to θ; estimators of the regression coefficients are consequently found by substitution of θ̂ back into (<ref>), i.e., β̂(θ̂).   In practice, we obtain ML or REML estimates of θ numerically using the general purpose optimization function  provided in the statistical software package R <cit.>.  Note that REML estimators tend to have less bias and better performance (in terms of mean squared error) than ML estimators, especially when p is large relative to n (; , p. 93).


Once the parameters are estimated for the spatial regression model, we use universal kriging to make predictions and construct prediction intervals (, pp. 151–155; , pp. 145–148).  The universal-kriging prediction and variance equations for the response at a new location s_0 are given by


    Ŷ(s_0)    = x(s_0)' β̂ + c(s_0)' Σ^-1 (Y - Xβ̂) 
    (Ŷ(s_0))    = C(s_0,s_0) - c(s_0)' Σ^-1c(s_0) + t(s_0)' (X' Σ^-1X)^-1t(s_0),


where  t(s_0) = x(s_0) - X' Σ^-1c(s_0), c(s_0) = (Y(s_0), Y) = (C(s_0, s_1), ⋯, C(s_0, s_n))', and x(s_0) is the covariate vector at s_0. Note that the covariance function is defined here as C(u,v) = σ_z^2 exp(||u-v||/α) + I(u=v)σ_ϵ^2 for all locations u,v∈ D.  Also, note that (<ref>) is derived as the homogeneously linear combination of the data, λ'Y where λ∈ℝ^n, that minimizes the mean-squared-prediction error, E(Y(s_0) - λ' Y)^2, subject to the unbiasedness constraint E(λ' Y) = E(Y(s_0)) = x(s_0)' β;  and (<ref>) is the minimized mean-square-prediction error, often referred to as the kriging variance.



 §.§ Reduced Rank Methods
 

For data sets with a large number of records, inverting the covariance matrix when optimizing the log-likelihood function (<ref>) can be computationally burdensome.  For example, the motivating 2008/09 NRSA data set contains nearly 2000 records; thus there is a computational cost when estimating a spatial regression model for this data set.  To accelerate parameter estimation for the SLM we consider reduced rank methods <cit.>.  In this section we specify the reduced rank method used in the study; Section <ref> will subsequently discuss the application of this method to a computationally efficient covariate selection routine.

Consider a set of r knot locations {k_i : i = 1, ⋯, r }, distributed over the same domain as the observed data, such that r << n. Instead of modeling the covariance matrix for Y in terms of the Euclidean distances between the observed locations, we can alternatively model the covariance matrix in terms of the knot locations as


    Σ = SK^-1S' + σ^2_ϵI,


where S is an n × r matrix with (i,j) element σ^2_z exp (-‖s_i - k_j ‖ / α ); K is an r × r matrix with (i,j) element σ^2_z exp (-‖k_i - k_j ‖ / α ); and σ^2_z, α, and σ^2_ϵ are parameters to be estimated.  An advantage of the specification in (<ref>) is that application of the well-known Sherman-Morrison-Woodbury formula (see <cit.> for a review) yields the following decomposition:


    Σ^-1 = σ_ϵ^-2[ I - S(σ_ϵ^2 K + SS')^-1S' ].


Since (<ref>) only involves inverting an r × r matrix computation speed is greatly improved.

Note that (<ref>) can be viewed as the covariance matrix for Y in the spatial mixed effects model Y = X β + S γ + ϵ, where γ is an r× 1 vector of random effects such that (γ)=K^-1.  Also, one property of the covariance matrix specified in (<ref>) is that if the knots are the observed data locations {s_i}, then S = K = R, and consequently (<ref>) is equivalent to the full rank covariance matrix defined in (<ref>).



 §.§ Covariate Transformations
 
Many of the covariates in the StreamCat data set have nonlinear relationships with MMI.  For example, Figure <ref>(a,c) shows highly skewed relationships between MMI and two StreamCat covariates: watershed area in square km (WsAreaSqKm); and the percent of watershed area classified as developed, medium intensity land use within a 100-m buffer of a stream reach (PctUrbMd2006WsRp100).  The log-transformation helps linearize the relationship between MMI and PctUrbMd2006WsRp100 (Figure <ref>d), and also reveals a quadratic relationship between MMI and WsAreaSqKm (Figure <ref>b).  While not shown here, many of the other StreamCat covariates exhibit similar types of nonlinearities, and further motivate considering covariate transformations.

To linearize relationships between the covariates and response variable, we estimate Box-Cox transformations <cit.> for the covariates.  Specifically, we estimate transformations of the form


    g(x; λ_1, λ_2) = (x+λ_2)^λ_1 - 1/λ_1   λ_1 ≠ 0
    log(x+λ_2)    λ_1 = 0,


where x > - λ_2.  Note that Box-Cox transformations were first proposed as a way to transform the response variable <cit.>, however, these types of power transformations have also been applied to the independent variables in regression modeling (, pp. 50–63).

Figure <ref> suggests that StreamCat covariates can be zero-inflated (e.g., PctUrbMd2006WsRp100), or have quadratic relationships with the response (e.g., log-transformed WsAreaSqKm).  Different types of transformation effects are considered depending on whether or not the StreamCat covariate is zero-inflated.  To estimate transformations for the zero-inflated covariates, we estimate the following linear models for varying values of λ_1 and λ_2:


    y    = β_0 + β_1 I(x_i ≠ 0) + ϵ, 
    
    y    = β_0 + β_1 g(x_i; λ_1,λ_2) I(x_i ≠ 0) + ϵ, 
    
    y    = β_0 + β_1 I(x_i ≠ 0) + β_2 g(x_i; λ_1,λ_2) I(x_i ≠ 0) + ϵ.


Here y is MMI, x_i is the i^th StreamCat covariate, ϵ is the error term, and I(a) is the indicator function, equal to one if the argument a is true, and zero otherwise.  For each zero-inflated covariate, we use the Aikaike Information Criterion (AIC; ) to select optimal (λ_1, λ_2) and the type of transformation:  zero/nonzero indicator (<ref>), interaction between the indicator and transformed covariate (<ref>), or both (<ref>).  That is, out of several candidate values for (λ_1, λ_2), we select the Box-Cox parameter values and type of transformation effect that corresponds to the linear model (<ref>, <ref>, or <ref>) with the lowest AIC.  To estimate transformations for the other covariates (not zero-inflated), we estimate the following linear models for varying values of λ_1 and λ_2:


    y    = β_0 + β_1 g(x_i; λ_1,λ_2) + ϵ, 
    
    y    = β_0 + β_1 g(x_i; λ_1,λ_2) + β_2 (g(x_i; λ_1,λ_2))^2 + ϵ.


For each covariate that is not zero-inflated, we again use the AIC to select optimal (λ_1, λ_2) and the type of transformation: linear (<ref>) or quadratic (<ref>) polynomial.  In practice, we vary the values of the exponent parameter λ_1 between 0 and 3, and try several shifting parameters λ_2 to ensure that (<ref>) is well defined.  We also define a covariate x_i as being zero-inflated if the proportions of zeros is greater than 2%.  Note that the transformations are estimated separately for each covariate, and that spatial autocorrelation is ignored while estimating transformations because otherwise the procedure would be too slow computationally.

Once transformations have been selected, a new design matrix containing the transformations for each StreamCat covariate can be used to fit either a multiple regression or spatial regression model.  Since we include indicator variables for zero-inflated covariates and quadratic polynomial effects, the transformed design matrix is larger than the design matrix without transformations.  In the next section, we discuss a covariate selection approach for reducing the number of parameters in a spatial regression model.



 §.§ Covariate Selection
 

Covariate selection for the spatial regression model is implemented in two phases.  For the first phase, we fit a multiple linear regression model (LM) with the full set of covariates from the StreamCat data set.  Dummy variables for the ecoregions (Figure <ref>) are also included as additional covariates in the LM to account for regional variations in MMI development.   Variables are then selected using a backwards stepwise algorithm (i.e., the  function from <cit.>).  Note, we start by selecting variables for an LM rather than an SLM since the LM can be rapidly estimated, and software is readily available for variable selection.

For the second phase, we estimate an SLM with the variables selected for the LM.  We then conduct further variable selection for the SLM since some covariates may no longer be significant once spatial autocorrelation is taken into account <cit.>.  Specifically, we repeatedly remove the covariate with the largest absolute t-statistic and re-fit the SLM until the model's AIC score starts to increase.  To speed up ML estimation of the SLM during this procedure we use the reduced rank method (Section <ref>).  Once all variables are selected for the SLM, REML with the full rank covariance matrix is used to estimate the final model.  A step-by-step description of the covariate selection procedure is provided in the Supplement (Section S1).



§ RANDOM FOREST MODEL


Random forest (RF) modeling has become a popular technique for regression and classification with complex environmental data sets <cit.>.    In contrast to multiple regression, RF is an entirely nonparametric and algorithmic procedure which makes no a priori assumptions about the relationship between the predictor variables and the response.  RF has a reputation for good predictive performance when the data contain a large number predictor variables, and when there are complex nonlinearities and interaction effects in the relationship between the predictors and response variable <cit.>.  In addition, RF provides several measures of variable importance that allow for interpretation of the fitted model (, p. 593).

An RF model can be defined as a collection of regression trees {T_b: b=1,⋯,B} each built from a bootstrap sample of the data set {Y, X}.  When growing each tree T_b, at each parent node a subset of m of the p predictor variables are randomly selected, and the best split-point is found among those m variables to form two daughter nodes.  The trees in the RF ensemble are grown deep with no pruning. Bagging trees <cit.> are the special case when m=p (i.e., all predictor variables are used as candidates for splitting at each node).  An RF prediction at a new site with predictor values x = (x_1, ⋯, x_p) is found by averaging the predictions made by each tree in the ensemble:


    f̂(x) = 1/B∑_b=1^B T_b(x).


RF is also commonly used for classification, in which case T_b(x) takes on discrete values (e.g., 0/1 for binary classification) and the RF prediction can be defined as the majority vote from the collection of class predictions {T_b(x)}.  However, in this study we only consider RF for regression.  Note that the RF algorithm produces individual tree estimators with high variance.  That is, a regression tree fit to different portions of the data can yield very different predictions at an unsampled site.  The main idea behind RF is that averaging over many tree models is a way to reduce variance, and thereby improve predictive performance relative to a single tree model <cit.>.  Moreover, only considering a random subset of m < p predictors at each node has the effect of decorrelating the trees in the ensemble, which can further improve the performance of the RF model relative to bagging.  See <cit.> for a comprehensive review of RF and relevant theory.

We implement RF using the R package  <cit.>.  There are two tuning parameters when estimating an RF model with this package: the number of trees B, and the number of predictor variables m randomly selected at each node.  However, RF is generally insensitive to choice of tuning parameters, and the defaults perform adequately for most data sets <cit.>.  In practice, we use B=1000 trees and the default m=p/3.  We use more trees than the default value (500) since this is recommended for data sets that have a large number of predictors <cit.>.  For the RF model of MMI, we also use the full set of StreamCat predictor variables, as well as an additional categorical predictor for the ecoregions.  We do not perform additional subset selection since the RF algorithm is robust to handling large sets of predictor variables <cit.>.



 §.§ Quantile Prediction Intervals
 

Prediction intervals for RF can be computed using quantile regression forests (QRF; ).  While RF provides information on the conditional mean of the response,  QRF instead provides information on the conditional distribution function of the response.  Approximation of the conditional distribution function is useful for making quantile predictions and forming associated prediction intervals.  For instance, a 90% prediction interval for the response at a new site with predictors x can be formed as the 0.05 and 0.95 quantile predictions denoted by [Q̂_0.05(x), Q̂_0.95(x)].  Here Q_α(x) defines the α-quantile, that is, the value of the random response variable Y such that the probability Y is less than Q_α(x), for given x, is exactly equal to α; Q̂_α(x) denotes the QRF estimator of this quantity.  A main distinction between the RF and QRF algorithms is that RF only keeps track of the mean value of the response data at each leaf (terminal node) of each tree.  QRF, on the other hand, keeps track of all the response data at each leaf of each tree and approximates the full conditional distribution with this additional information.  In practice, we implement the QRF method using the R package  <cit.>, which builds on the  package also used in this study.



 §.§ Random Forest Regression Kriging

Random forest regression kriging (RFRK) has been proposed in a number of studies as a way to account for spatial autocorrelation in RF modeling (e.g, ).  For RFRK, a prediction at a new site is given by summing the RF prediction and the kriging prediction of the RF residual.  Formally, an RFRK prediction of Y(s_0), at a new site s_0, is given by


    Ŷ(s_0) = f̂_RF(x(s_0)) + ê(s_0)


where f̂_RF is the RF prediction with covariates x(s_0), and ê(s_0) is the kriging prediction of the residual.  In practice, we use ML to estimate a simple-kriging model for the RF residuals that assumes a zero mean (i.e, E(e(s))=0) and exponential model for the covariance matrix.  Additionally, we use the simple-kriging variances for the residuals to construct prediction intervals.  Computational details are provided in  the Supplement (Section S2).



§ PERFORMANCE MEASURES
 
We assess the performance of different models for MMI using 10-fold cross validation.  Seven models of MMI are considered for the comparison: (1) an ordinary-kriging model, i.e., an SLM with no covariates and a single intercept term (X is a n×1 column vector of 1's); (2) an LM with no transformations; (3) an SLM with no transformations; (4) an LM with transformations; (5) an SLM with transformations; (6) an RF model; and (7) an RFRK model.

The root-mean-square prediction error (RMSPE) and coverage of the prediction intervals are used to evaluate the cross-validation performance of the different models.  Let Y_i denote the i^th observed value and Ŷ_i the 10-fold cross-validation prediction.  The RMSPE is computed as the square root of the mean of (Y_i-Ŷ_i)^2 and coverage of the 90% prediction intervals is computed as the mean of I(Ŷ_i - 1.645 (Ŷ_i) < Y_i < Ŷ_i + 1.645 (Ŷ_i)) for all i in 1,⋯,n, where I is the indicator function and (Ŷ_i) is the prediction standard error.  Since we estimate quantile prediction intervals for RF, the coverage of the 90% prediction intervals is computed as the mean of I(Q̂_0.05(x_i) < Y_i < Q̂_0.95(x_i)) for all i in 1,⋯,n, where x_i are the predictor variables at the i^th site and Q̂_α(x_i) is the 10-fold cross-validation prediction of the α-quantile defined in Section <ref>.



§ RESULTS
 
The 10-fold cross-validation performance measures for modeling MMI are presented in Table <ref>.  In terms of RMSPE, the SLM with transformations, respectively followed by RFRK, RF, and the LM with transformations resulted in the best performance.  The SLM and LM without transformations did not perform nearly as well; and not surprisingly, the ordinary-kriging model had the lowest RMSPE.  The results show that covariate transformations for the LM and SLM were necessary to obtain performance comparable with RF.  The covariate transformations also resulted in an LM which had approximately the same performance as RF.  Accounting for spatial autocorrelation improved the performance of the SLM relative to the LM for both the transformed and untransformed cases.  Moreover, additional covariate selection for the SLM (Section <ref>) resulted in a more parsimonious model than the LM.  The RFRK model also performed better than the RF model, although the difference was not substantial (Pearson correlation between RF and RFRK cross-validation predictions was greater than 0.98).

The coverages of the 90% and 95% prediction intervals were close to nominal for all models in Table <ref>.  That is, for each method, the prediction intervals computed during cross-validation contained the true observed MMI values with approximately the correct proportion.  However, even though the coverages were similar, there were considerable differences between the lengths of the prediction intervals from the different methods (Figure <ref>).  For instance, there was much greater variability in the lengths of the RF quantile prediction intervals than the SLM and RFRK prediction intervals.  The lengths of the prediction intervals for the SLM also showed a positive skew (Figure <ref>); this can be explained by the universal-kriging variances getting larger for sites which fall away from than bulk of the data in the covariate space <cit.>.  The distribution of the prediction interval lengths for RFRK was more symmetric, in comparison, since the simple-kriging variances only account for the uncertainty due to relative geographic distances between points, and not possible quantitative extrapolation in the covariates.

Scatter plots of predicted versus observed values are presented in Figure <ref>.  The scatter plots reveal that the predictions from the different models tend towards the mean of the observed MMIs (36.9).  This effect was most pronounced for the ordinary-kriging, RF, and RFRK models; in comparison, the LM and SLM had wider distributions of predicted values.   While most of the predictions from the LM and SLM (with and without transformations) were within the defined range of the MMI (0–100), Figure <ref> shows that a small percentage (< 0.5%) of predictions were negative.  The predictions from the RF and RFRK models, on the other hand, were contained within the observed MMI range.  Note that, by definition, RF models cannot predict outside the range of the observed data since each tree model within the forest makes predictions by taking the mean of the response data falling within a given leaf (terminal) node.

Covariance parameter estimates (nugget, partial sill, and range) for the spatial regression models are presented in Table <ref>.  The ordinary kriging model has a larger estimated nugget parameter, σ̂^2_ϵ, and smaller nugget-to-sill ratio, σ̂^2_ϵ / (σ̂^2_z + σ̂^2_ϵ), than the SLM.  This is expected since the covariates in the SLM explain additional variation in MMI not accounted for by ordinary kriging.  Moreover, the spatially-referenced StreamCat covariates in the SLM account for some spatial autocorrelation in MMI.  To further assist interpretation, Table <ref> also presents the effective range, -α̂log[0.01 * (σ̂_z^2 + σ̂_ϵ^2) / σ̂^2_z], which is defined here as the distance beyond which spatial autocorrelation is less than 0.01 (i.e., the distance h found by solving ρ(h) = C(h) / C(0) = 0.01; ).  The effective ranges for ordinary-kriging and the SLM reveal that spatial autocorrelation in the data is close to zero for distances beyond 480–580km.  Additionally, for the RFRK model, both the effective range (160km) and nugget-to-sill ratio (0.951) indicate little, perhaps negligible, spatial autocorrelation in the RF residuals.  Note that, for the effective range calculations we use 0.01 instead of 0.05, which is more common, since the nugget-to-sill ratio for RFRK is greater that 0.95.

Maps of the RF and SLM predictions of MMI are presented in Figure <ref> (a,b).  The maps show MMI predictions for 1.1 million perennial stream reaches within the CONUS.  Again, predictions were made only for perennial stream reaches since the sampling frame for the 2008/09 NRSA is limited to these types of streams.  Overall, the maps show similar spatial patterns in the MMI predictions from the two models.  As expected, regions dominated by urban or agricultural land tend to have lower MMI predictions than more remote regions.  The most noticeable difference between the prediction maps is that the SLM shows a wider distribution of predicted values than RF, with sharper differences between regions with low and high MMI predictions (e.g., Willamette Valley versus Cascades in Oregon; Piedmont versus Blue Ridge Mountains in Georgia, S. and N. Carolina, and Virginia).  Also note that the RF predictions never reach zero, while about 1.2% of the SLM predictions are negative and set to zero in Figure <ref> since MMI is defined between 0–100.

In contrast to the prediction maps, the maps of the RF and SLM prediction errors (lengths of 90% prediction intervals) are strikingly different (Figure <ref>c,d).  There is much greater variability in the lengths of prediction intervals in the map for the RF model than the SLM (note, this is consistent with the cross-validation results in Figure <ref>).  Moreover, the SLM prediction intervals show greater precision in regions that are more densely sampled (e.g., Mississippi Basin).  Contrastingly, the precision of the RF quantile prediction intervals do not apparently scale with the density of sampling locations.

Lastly, both the SLM and RF models provide measures of variable importance.  For the SLM, covariates can be ranked in terms of the absolute t-statistics for the coefficients.  For RF, covariates can be ranked in terms of a permutation-based measure (i.e., the average increase in mean-square error when each covariate is permuted in the out-of-bag data; , p. 593).  The highest ranked variables for modeling MMI were similar for the RF model and SLM with transformations.  Specifically, the covariates for watershed area, average topographic wetness index, and ecoregions were ranked in the top five for both models.  An SLM regression coefficient summary and RF variable importance plot are provided in the Supplement (Section S3).



§ SIMULATION
 
Modeling the MMI data indicated that the SLM, with appropriate transformations of the covariates to obtain near linear relationships between response and covariates, performed slightly better than RF. However, this is but a single data set with apparently little autocorrelation in the residuals. We explore the affect of nonlinear relationships between response and covariates, R^2, and varying amounts of autocorrelation, through simulations.

Data for this simulation study are generated from the following model:


    y(s)    = f(x_1, ⋯, x_4) + δ(s)  = c[a g(x_1,x_2) +  h(x_3, x_4)] + δ(s) 
       = c[a sin(5π x_1 x_2) + 2 x_3 - x_4] + δ(s).


Here δ(s) = z(s) + ϵ is a spatially autocorrelated error term such that (z(s), z(s+h)) = σ^2_z exp(-‖h‖/α) and (ϵ) = σ^2_ϵ is the nugget effect.  The parameter c governs the proportion of variance in y explained by the covariates in the systematic component of the model f.  The parameter a governs amount of nonlinearity in f, which is decomposed into a nonlinear term g and linear term h.  Note that the sine function, with multiplicative interaction between x_1 and x_2, in (<ref>) was chosen since it is difficult to recover with a linear model, and so RF is expected to have advantages if the data are generated from this type of nonlinear function.

The following characteristics of the simulated data are varied by adjusting the values of the parameters in (<ref>):


  * The amount of spatial autocorrelation in the error term δ(s).  We set σ^2_z = 1 and σ^2_ϵ = 9 for a low amount of autocorrelation, and σ^2_z = 9 and σ^2_ϵ = 1 for a high amount of autocorrelation.  The range parameter is always α = 0.5.

  * The empirical R^2, i.e., the proportion of variation in y explained by f.  The value of parameter c is adjusted in each simulation run to give an empirical R^2 which is either high (0.9) or low (0.1).

  * Whether the linear or nonlinear term dominates.  The value of parameter a is adjusted in each simulation run so that the proportion of variance in f explained by the nonlinear term g is either high (0.9) or low (0.1).

This gives a total of 2^3=8 cases since there are 2 levels (high/low) for each characteristic (spatial autocorrelation, empirical R^2, and amount of nonlinearity).  The 8 cases are summarized in Table <ref>.

For each simulation case, we generated 20 data sets [y; x_1, ⋯, x_4] of 1500 points with locations randomly generated over the unit square.  For each data set, 500 points were used for training, and the other 1000 as a test set.  Values for the covariates x_i were drawn from Unif[0,1].  Data from the spatially autocorrelated error term δ(s) in (<ref>) were generated using the Cholesky decomposition method (, pp. 201–202). Values of parameters c and a were selected to fix the empirical R^2 and amount of nonlinearity in the simulated data sets generated for each case.  Since values of c and a varied, Table <ref> presents the averaged values.

The LM, SLM, RF, and RFRK models are compared in the simulations.  The SLM is fit using REML with the full rank covariance matrix, and no covariate transformations are considered. Model performance measures (RMSPE and prediction interval coverage) are averaged over the 20 simulated data sets generated for each case.  The simulation code is provided in an R package available at <https://github.com/ericwfox/slmrf>.



 §.§ Simulation Results


Simulation results are presented in Table <ref>. When there was a high amount of autocorrelation in the error term and R^2=0.1 (case 2,6), SLM and RFRK performed substantially better than LM and RF.  When R^2=0.9 and the nonlinear component dominated (case 3,4), RF and RFRK performed substantially better than LM and SLM; RFRK also performed better than RF when there was a high amount of autocorrelation in the error term (case 4).  When R^2=0.9 and the linear component dominated (case 7,8), the SLM had the best performance among all methods; RFRK also performed better than LM when there was a high amount of autocorrelation in the error term (case 8). When the nugget effect dominated (case 1,5), all models performed similarly in terms of RMSPE, and the SLM had slightly better performance than other methods.  For all cases, SLM performed better than LM, and RFRK performed at least as well as RF. However, this is reasonable since there was some amount of autocorrelation in the data generated for each case.  Moreover, when there was only a small amount of autocorrelation in the error term and R^2=0.9 (case 3,7), the spatial models performed approximately as well as the non-spatial models (i.e., RF performed as well as RFRK in case 3, and LM performed approximately as well as SLM in case 7).

The coverages of the 90% prediction intervals for LM, SLM, and RFRK were close to nominal for all simulation cases.  The quantile prediction intervals for RF showed over-coverage when the linear term dominated and R^2=0.9 (case 7,8), but were otherwise reasonable, although not as precise as the other methods.



§ DISCUSSION AND CONCLUSIONS

In this article we compared spatial regression and RF methods for modeling stream condition (MMI) with over 200 potential covariates.  We used the models for prediction and uncertainty quantification of MMI at 1.1 million perennial stream reaches across the CONUS.  Initial exploratory analysis revealed highly nonlinear relationships between StreamCat covariates and MMI scores, which motived the application of Box-Cox transformations for the covariates.  We found that the SLM with transformations and RF model performed comparably well in terms of cross-validated RMSPE.  However, the SLM without transformations did not perform nearly as well as RF.  Thus, the estimation of transformations to account for nonlinearities in the data was an important step for constructing a suitable spatial regression model.  The maps of the SLM and RF predictions showed similar spatial trends in stream condition, although the RF predictions were smoother and had greater tendency to concentrate around the mean.  Many of the top predictors identified by each method were also similar.

A novel contribution of this study was the assessment and comparison of prediction intervals for the spatial regression and RF methods. The construction of prediction intervals is not yet common practice in RF modeling.  In contrast to geostatistics, there is no consensus in the RF literature on best practices for uncertainty quantification.  We investigated two ways to construct prediction intervals for RF models: first, by using the quantile regression forest method of <cit.>; and second, by fitting the RFRK model and using the simple-kriging variances for the RF residuals to form intervals.  We found that coverages of the prediction intervals for the SLM, RF, and RFRK models of stream condition were close to nominal (Table <ref>).  However, the lengths of the RF prediction intervals, computed using quantile regression forests, had much greater variability than the SLM and RFRK prediction intervals.  One explanation for these differences is that the kriging variances are optimized by minimizing the mean-square-prediction error, whereas the RF quantile prediction intervals are not found by directly minimizing a loss function.  The large amount of variability in the prediction interval lengths for quantile regression forests was also acknowledged in <cit.> in applications to a variety of data sets.

The results of this study indicate that there are several trade-offs when deciding between an RF or spatial regression approach to modeling a large environmental data set.  We summarize these below:


  * Predictions from RF will always be within the range of the observed data, whereas spatial regression can extrapolate outside this range.  In the context of modeling MMI, this was an advantage of the RF approach since the MMI is bounded between 0-100; the SLM also generated some negative MMI predictions that needed to be set to zero in the prediction map (Figure <ref>).  However, in applications to other data sets, predicting within the range of sampled values is not, in general, an advantage.  For instance,  for an unbounded normally distributed response variable, if only 1% of the data were sampled, then we would expect that, in the other 99% unsampled sites, there will be values both greater and less than the values in the sample.

  * The SLM stands out as a better descriptive model for ecological processes than RF.  The initial exploratory analysis and transformation procedure provided insights into the functional relationships between the covariates and MMI response variable.  In contrast, the ways in which RF deals with nonlinearities and interactions are hidden in the ensemble of trees and difficult to interpret.

  * RF has a slight computational edge over the SLM.  The RF algorithm is easy to implement using the  package, and RF models are generally insensitive to values of the tuning parameters.  However, computational considerations for fitting an SLM are also not overly-demanding with modern approaches such as REML and reduced rank methods.

  * The results from the data analysis (Section <ref>) suggest advantages to the spatial regression approach for uncertainty quantification.  The SLM prediction intervals were narrower, on average, than the RF quantile prediction intervals.  Moreover, the prediction intervals for the SLM are more suitable for spatial data since they scale with sampling density.

Generally, in applications to similar types of large environmental data sets, RF has considerable advantages over the SLM only when treating each approach as a black box method, as we discussed in Section <ref>.  We recommend the SLM if the practitioner takes a more careful approach to modeling by exploring the data, estimating covariate transformations to account for nonlinearities, and implementing model diagnostics.  While RF is easier to implement, the SLM has advantages for inferential tasks such as constructing prediction intervals and assessing covariate significance.

The simulations demonstrated that no single type of model performs best under all conditions, and that each method is designed for specific purposes.  For data sets with a high amount of nonlinearity in the covariates, and transformations to linearity are difficult or impossible, RF or RFRK are superior methods that can uncover patterns and interactions that are difficult to recover with an LM or SLM.  However, for data sets with a high amount of spatial autocorrelation and linear structure in the covariates, the SLM is the superior method.  Also, if the data have a small amount spatial autocorrelation, then it may not be worth the computational effort to fit a spatial model, and either RF or LM are sufficient.  The simulation results also indicate that the SLM prediction intervals generally have better coverage than the RF quantile prediction intervals.

Going back to our introductory paragraph, environmental data may be large in n (rows) or p (columns). For spatial models, research for large n is very active, including the reduced rank approaches, among others. Less attention is given to large p, although many proven techniques can be combined into an overall strategy. We suggest that modelers of spatial data carefully consider transformations to linearity and subsequent removal of covariates to obtain a parsimonious set of (transformed) covariates, including possible interactions. We provided one such example, creating indicator variables for covariates with excessive zeros, using Box-Cox transformations on nonzero covariate values, and creating their interaction. Model selection was possible for large p in the presence of large n using reduced rank methods. We stress that this is not the only strategy, but rather an example of how to proceed for both large n and p, which has received little attention. Given such a strategy, we created an SLM model that slightly outperformed RF, which requires less interaction with the data.  Conclusively, there is no correct way to statistically analyze and model large environmental data sets.  The results of this study suggest that a variety of modeling approaches can be considered, and that each approach can lead to different insights into the data set and applied problem.  By comparing spatial regression to RF we ultimately found ways to improve both techniques.





§ ACKNOWLEDGMENTS

We thank Dave Holland (US EPA, National Exposure Research Laboratory, Exposure Methods and Measurements Division) for providing valuable comments that improved this paper.  This manuscript has been subjected to review by the Western Ecology Division of ORD's National Health and Environmental Effects Research Laboratory and approved for publication.  Approval does not signify that the contents reflect the views of the Agency, nor does mention of trade names or commercial products constitute endorsement or recommendation for use.  The data from the 2008/09 NRSA used in this paper resulted from the collective efforts of dedicated field crews, laboratory staff, data management and quality control staff, analysts and many others from EPA, states, tribes, federal agencies, universities and other organizations. For questions about these data, please contact <nars-hq@epa.gov>.



§ SUPPLEMENTARY MATERIAL

Supplementary material related to this manuscript can be accessed at the following GitHub repository: <https://github.com/ericwfox/slmrf>.  The repository contains an R package with the code for the simulation study in Section <ref>.  The repository also contains a supplementary PDF with (1) a step-by-step description of the covariate selection procedure; (2) computation details of the random forest regression kriging computations; and (3) additional tables and figures.

apalike


































