R Under development (unstable) (2024-09-02 r87090 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(automap) > library(sp) > # Neccessary to silence sf startup messages > suppressMessages(library(sf)) > > data(meuse) > coordinates(meuse) = ~x+y > data(meuse.grid) > gridded(meuse.grid) = ~x+y > > kr.cv = autoKrige.cv(log(zinc)~1, meuse, model = c("Exp")) > kr_dist.cv = autoKrige.cv(log(zinc)~sqrt(dist), meuse, + model = c("Exp")) > kr_dist_ffreq.cv = autoKrige.cv(log(zinc)~sqrt(dist)+ffreq, + meuse, model = c("Exp")) > > summary(kr.cv) [,1] mean_error 0.002008 me_mean 0.0003412 MAE 0.2918 MSE 0.1549 MSNE 0.8555 cor_obspred 0.8374 cor_predres 0.04027 RMSE 0.3936 RMSE_sd 0.5452 URMSE 0.3936 iqr 0.4275 > summary(kr_dist.cv) [,1] mean_error -0.003065 me_mean -0.0005207 MAE 0.2707 MSE 0.143 MSNE 1.071 cor_obspred 0.8509 cor_predres -0.02513 RMSE 0.3781 RMSE_sd 0.5238 URMSE 0.3781 iqr 0.4035 > summary(kr_dist_ffreq.cv) [,1] mean_error -0.0008806 me_mean -0.0001496 MAE 0.2345 MSE 0.1032 MSNE 1.083 cor_obspred 0.8949 cor_predres -0.02777 RMSE 0.3213 RMSE_sd 0.4451 URMSE 0.3213 iqr 0.3629 > > compare.cv(kr.cv, kr_dist.cv, kr_dist_ffreq.cv) kr.cv kr_dist.cv kr_dist_ffreq.cv mean_error 0.002008 -0.003065 -0.0008806 me_mean 0.0003412 -0.0005207 -0.0001496 MAE 0.2918 0.2707 0.2345 MSE 0.1549 0.143 0.1032 MSNE 0.8555 1.071 1.083 cor_obspred 0.8374 0.8509 0.8949 cor_predres 0.04027 -0.02513 -0.02777 RMSE 0.3936 0.3781 0.3213 RMSE_sd 0.5452 0.5238 0.4451 URMSE 0.3936 0.3781 0.3213 iqr 0.4275 0.4035 0.3629 > > > meuse = as(meuse, "sf") > meuse.grid = as(meuse.grid, "sf") > kr.cv.sf = autoKrige.cv(log(zinc)~1, meuse, model = c("Exp")) > kr_dist.cv.sf = autoKrige.cv(log(zinc)~sqrt(dist), meuse, + model = c("Exp")) > kr_dist_ffreq.cv.sf = autoKrige.cv(log(zinc)~sqrt(dist)+ffreq, + meuse, model = c("Exp")) > > summary(kr.cv.sf) [,1] mean_error 0.002008 me_mean 0.0003412 MAE 0.2918 MSE 0.1549 MSNE 0.8555 cor_obspred 0.8374 cor_predres 0.04027 RMSE 0.3936 RMSE_sd 0.5452 URMSE 0.3936 iqr 0.4275 > summary(kr_dist.cv.sf) [,1] mean_error -0.003065 me_mean -0.0005207 MAE 0.2707 MSE 0.143 MSNE 1.071 cor_obspred 0.8509 cor_predres -0.02513 RMSE 0.3781 RMSE_sd 0.5238 URMSE 0.3781 iqr 0.4035 > summary(kr_dist_ffreq.cv.sf) [,1] mean_error -0.0008806 me_mean -0.0001496 MAE 0.2345 MSE 0.1032 MSNE 1.083 cor_obspred 0.8949 cor_predres -0.02777 RMSE 0.3213 RMSE_sd 0.4451 URMSE 0.3213 iqr 0.3629 > > compare.cv(kr.cv, kr_dist.cv, kr_dist_ffreq.cv, kr.cv.sf, kr_dist.cv.sf, kr_dist_ffreq.cv.sf) kr.cv kr_dist.cv kr_dist_ffreq.cv kr.cv.sf kr_dist.cv.sf mean_error 0.002008 -0.003065 -0.0008806 0.002008 -0.003065 me_mean 0.0003412 -0.0005207 -0.0001496 0.0003412 -0.0005207 MAE 0.2918 0.2707 0.2345 0.2918 0.2707 MSE 0.1549 0.143 0.1032 0.1549 0.143 MSNE 0.8555 1.071 1.083 0.8555 1.071 cor_obspred 0.8374 0.8509 0.8949 0.8374 0.8509 cor_predres 0.04027 -0.02513 -0.02777 0.04027 -0.02513 RMSE 0.3936 0.3781 0.3213 0.3936 0.3781 RMSE_sd 0.5452 0.5238 0.4451 0.5452 0.5238 URMSE 0.3936 0.3781 0.3213 0.3936 0.3781 iqr 0.4275 0.4035 0.3629 0.4275 0.4035 kr_dist_ffreq.cv.sf mean_error -0.0008806 me_mean -0.0001496 MAE 0.2345 MSE 0.1032 MSNE 1.083 cor_obspred 0.8949 cor_predres -0.02777 RMSE 0.3213 RMSE_sd 0.4451 URMSE 0.3213 iqr 0.3629 > > proc.time() user system elapsed 13.73 0.64 14.43