This function is used to facilitate comparisons between species in the same
study area. It speeds up the computation of multiple departures by calculating
the global covariance matrix as a first step, which
can then be fed into the departure
function as a first argument.
This saves the user from having to calculate the global covariance matrix for
each species, which can take quite a bit of time.
GLdeparture(
x,
y,
center = TRUE,
scale = TRUE,
filename = "",
progress = FALSE,
parallel = FALSE,
n = 1,
cl = NULL,
keep.open = FALSE,
...
)# S4 method for Raster,Raster
GLdeparture(
x,
y,
center = TRUE,
scale = TRUE,
filename = "",
progress = FALSE,
parallel = FALSE,
n = 1,
cl = NULL,
keep.open = FALSE,
...
)
# S4 method for Raster,missing
GLdeparture(
x,
y,
center = TRUE,
scale = TRUE,
filename = "",
progress = FALSE,
parallel = FALSE,
n = 1,
cl = NULL,
keep.open = FALSE,
...
)
Raster* object of p historical climate layers
Raster* object of p future climate layers, with the same names as
x
logical or numeric. If TRUE
, centering is done by
subtracting the layer means (omitting NAs), and if FALSE
, no centering
is done. If center
is a numeric vector with length equal to the
nlayers(x)
, then each layer of x
has the corresponding value
from center subtracted from it
logical or numeric. If TRUE
, scaling is done by dividing
the (centered) layers of x
by their standard deviations if center is
TRUE
, and the root mean square otherwise. If scale is FALSE
,
no scaling is done. If scale is a numeric vector with length equal to
nlayers(x)
, each layer of x
is divided by the corresponding
value. Scaling is done after centering
character. Optional filename to save the RasterBrick output
to file. If this is not provided, a temporary file will be created for large
x
logical. If TRUE
, messages and progress bar will be
printed
logical. If TRUE
then multiple cores are utilized
numeric. Number of CPU cores to utilize for parallel processing
optional cluster object
logical. If TRUE
and parallel = TRUE
, the
cluster object will not be closed after the function has finished
Additional arguments for writeRaster
Returns an S4 object of class GLcenfa
with the following components:
Raster* x
of p layers, possibly centered and scaled
Global p x p covariance matrix
If there is too much correlation between the layers of x
, the covariance
matrix will be singular, which will lead to later problems in computing the overall
departures of species. In this case, a warning will be issued, suggesting the
removal of correlated variables or a transformation of the data.
# NOT RUN {
gld <- GLdeparture(x = climdat.hist, y = climdat.fut)
# }
Run the code above in your browser using DataLab