Predict bag of models in space
Usage
bag_predict_spat(
bag,
data,
input_type = c("df", "rast")[1],
output_type = c("df", "rast")[2],
prediction_type = c("exp", "exponential", "linear")[1],
standardize = FALSE,
gridalign = TRUE,
gid = "gid",
coords = c("x33", "y33"),
crs = NULL,
output_rescale = FALSE,
prediction_max_quantile = 0.999,
uncertainty_quantiles = c(0.25, 0.75),
plotit = FALSE,
verbose = FALSE
)
bag_predict_spat_vars(
bag,
data,
predictor_table_zoi,
input_type = c("df", "rast")[1],
output_type = c("df", "rast")[2],
prediction_type = c("exp", "exponential", "linear")[1],
standardize = FALSE,
what = c("wMean", "wMedian", "ind"),
gridalign = TRUE,
gid = "gid",
coords = c("x33", "y33"),
crs = NULL,
prediction_max_quantile = 0.999,
uncertainty_quantiles = c(0.25, 0.75),
plotit = FALSE,
verbose = FALSE
)
Arguments
- bag
[bag,list]
A bag of models, resulting from a call tobag_models()
.- data
[data.frame,SpatRaster]
The spatial grid or stack of rasters with the layers in space, to be used for the spatial prediction. All variables in the bag$formula must be present indata
.- input_type
[string(1)="df"]{"df","rast"}
Type of input object. Either adata.frame
with the predictor variables as columns (ifinput_type = "df"
, default), or aSpatRaster
with the predictor variables as layers (ifinput_type = "rast"
). So far, onlyinput_type = "df"
is implemented.- output_type
[string(1)="rast"]{"df","rast"}
Type of output object. Typically, the same type of object asinput_type
, but rasters can also be saved if the input is adata.frame
whenoutput_type = "rast"
, and data.frames can also be saved if the input is aSpatRaster
whenoutput_type = "df"
.- prediction_type
[string(1)="exp"]{"exp", "exponential", "linear"}
Type of transformation for the prediction. One of"exp"
or"expornential"
for exponential response or"linear"
for linear response.- gid
[string(1)="gid"]
String with the name of the "gid" or point ID column indata
. Only relevant ifinput_type = "df"
.- coords
[vector,string(2)=c("x", "y")]
Vector with two elements with the names of the coordinates representing (x,y) coordinates for the pixels. Only relevant ifinput_type = "df"
.- crs
[string(1)=NULL]
Code for the coordinate reference system of the output raster. Only relevant ifinput_type = "df"
. For more details, checkterra::crs()
.