spautorRF {spmodel} | R Documentation |
Fit random forest spatial residual models
Description
Fit random forest residual spatial linear models for areal data (i.e., spatial autoregressive models) using random forest to fit the mean and a spatial linear model to fit the residuals. The spatial linear model fit to the residuals can incorporate a variety of estimation methods, allowing for random effects, partition factors, and row standardization.
Usage
spautorRF(formula, data, ...)
Arguments
formula |
A two-sided linear formula describing the fixed effect structure
of the model, with the response to the left of the |
data |
A data frame or |
... |
Additional named arguments to |
Details
The random forest residual spatial linear model is described by
Fox et al. (2020). A random forest model is fit to the mean portion of the
model specified by formula
using ranger::ranger()
. Residuals
are computed and used as the response variable in an intercept-only spatial
linear model fit using spautor()
. This model object is intended for use with
predict()
to perform prediction, also called random forest
regression Kriging.
Value
A list with several elements to be used with predict()
. These
elements include the function call (named call
), the random forest object
fit to the mean (named ranger
),
the spatial linear model object fit to the residuals
(named spautor
or spautor_list
), and an object can contain data for
locations at which to predict (called newdata
). The newdata
object contains the set of
observations in data
whose response variable is NA
.
If spcov_type
or spcov_initial
(which are passed to spautor()
)
are length one, the list has class spautorRF
and the spatial linear
model object fit to the residuals is called spautor
, which has
class spautor
. If
spcov_type
or spcov_initial
are length greater than one, the
list has class spautorRF_list
and the spatial linear model object
fit to the residuals is called spautor_list
, which has class spautor_list
.
and contains several objects, each with class spautor
.
References
Fox, E.W., Ver Hoef, J. M., & Olsen, A. R. (2020). Comparing spatial regression to random forests for large environmental data sets. PloS one, 15(3), e0229509.
Examples
seal$var <- rnorm(NROW(seal)) # add noise variable
sprfmod <- spautorRF(log_trend ~ var, data = seal, spcov_type = "car")
predict(sprfmod)