This function is to make spatial predictions using the average of the hybrid method of random forest in ranger (RG) and ordinary kriging and the hybrid method of RG and inverse distance weighting (RGOKRGIDW).
rgokrgidwpred(
longlat,
trainx,
trainy,
longlatpredx,
predx,
mtry = function(p) max(1, floor(sqrt(p))),
num.trees = 500,
min.node.size = NULL,
type = "response",
num.threads = NULL,
verbose = FALSE,
idp = 2,
nmaxok = 12,
nmaxidw = 12,
vgm.args = ("Sph"),
block = 0,
...
)
a dataframe contains longitude and latitude of point samples (i.e., trainx and trainy).
a dataframe or matrix contains columns of predictive variables.
a vector of response, must have length equal to the number of rows in trainx.
a dataframe contains longitude and latitude of point locations (i.e., the centres of grids) to be predicted.
a dataframe or matrix contains columns of predictive variables for the grids to be predicted.
a function of number of remaining predictor variables to use as the mtry parameter in the randomForest call.
number of trees. By default, 500 is used.
Default 1 for classification, 5 for regression.
Type of prediction. One of 'response', 'se', 'terminalNodes' with default 'response'. See ranger::predict.ranger for details.
number of threads. Default is number of CPUs available.
Show computation status and estimated runtime.Default is FALSE.
numeric; specify the inverse distance weighting power.
for local predicting: the number of nearest observations that should be used for a prediction or simulation, where nearest is defined in terms of the space of the spatial locations. By default, 12 observations are used for OK.
for local predicting: the number of nearest observations that should be used for a prediction or simulation, where nearest is defined in terms of the space of the spatial locations. By default, 12 observations are used for IDW.
arguments for vgm, e.g. variogram model of response variable and anisotropy parameters. see notes vgm in gstat for details. By default, "Sph" is used.
block size. see krige in gstat for details.
other arguments passed on to randomForest or gstat.
A dataframe of longitude, latitude, predictions and variances. The variances are the same as the variances of rfokpred.
Liaw, A. and M. Wiener (2002). Classification and Regression by randomForest. R News 2(3), 18-22.
# NOT RUN {
data(petrel)
data(petrel.grid)
rgokrgidwpred1 <- rgokrgidwpred(petrel[, c(1,2)], petrel[, c(1,2, 6:9)],
petrel[, 3], petrel.grid[, c(1,2)], petrel.grid, num.trees = 500, idp = 2,
nmaxok = 12, nmaxidw = 12)
names(rgokrgidwpred1)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab