Recorrelate machine learning predictions according to a spatial decorrelation transformation.
recorrelate_newdata(object, ty_newdata)A decorrelate_newdata() object.
Predictions from the machine learning model trained on the spatially decorrelated data and applied to spatially decorrelated newdata.
A vector of predictions
params <- spcov_params("exponential", de = 1, ie = 0.2, range = 1e5)
decorr <- decorrelate_data(log_cond ~ temp, data = lake, spcov_params = params)
fit <- ranger::ranger(x = decorr$tX, y = decorr$ty)
decorr_newdata <- decorrelate_newdata(decorr, newdata = lake_preds)
rfpreds <- predict(fit, data = decorr_newdata$tX_newdata)$predictions
recorrelate_newdata(decorr_newdata, rfpreds)
#> 1 2 3 4 5 6 7 8
#> 6.395943 7.880294 6.675219 4.781835 5.422232 4.737969 5.970901 3.775050
#> 9 10
#> 7.300460 4.391073