Description Usage Arguments Value Examples
Make a prediction using an autoforest model returned from the autoforest
function.
1 2 3 4 5 6 7 8 9 10 11 |
autoforestModel |
An S3 object of type "autoforest" returned from the |
newdata |
The dataframe of predictors for use in prediction. |
newdataCoords |
the matrix of locations for all the information in newdata. Required argument if you set "useSpatialNodes" to TRUE. |
useSpatialNodes |
If TRUE, instead of running all the observations through the autocart tree, use the |
method |
If using the spatial nodes type of prediction, then the type of interpolation to use. The options are "idw" and "tps". |
distpower |
If using "idw" for the method, the power on distance. For example, setting this to 2 would mean inverse squared distance squared weighting. |
distpowerRange |
If using "idw" for the interpolation method, the range of distance powers to use on inverse distance weighting matched to terminal node Moran I measurements. |
modelByResidual |
When using interpolation, make a prediction using the region of interest's average and then interpolate the residual. |
decideByGC |
Use Geary's C in deciding to induce a local spatial process rather than Moran's I. |
A vector of predictions that correspond to the rows in newdata
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Load some data for an autoforest example
snow <- na.omit(read.csv(system.file("extdata", "ut2017_snow.csv", package = "autocart")))
y <- snow$yr50[1:40]
X <- data.frame(snow$ELEVATION, snow$MCMT, snow$PPTWT, snow$HUC)[1:40, ]
locations <- as.matrix(cbind(snow$LONGITUDE, snow$LATITUDE))[1:40, ]
# Create a control object for the autoforest tree
snow_control <- autocartControl(spatialBandwidthProportion = 1.0)
# Create an autoforest model with 5 trees (low number chosen for computation time)
snow_model <- autoforest(y, X, locations, 0.30, 0, snow_control, numtrees = 5)
# Predict for a subset of the data
new_X <- X[1:10, ]
new_loc <- locations[1:10, ]
predicted_values <- predictAutoforest(snow_model, new_X, new_loc, TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.