I’m trying to evaluate an ensemble SDM model that I had built using the ‘sdm’ package. I am able to obtain the evaulation (AUC, TSS) for the single models. I had came across the ‘mecofun’ package to utilise evalSDM to potentially calculate the weighted ensemble model, however the error implies, atleast to me, that the observation or predictions dataset is not the correct method?
# ensemble based on a Weighted averaging that is weighted using TSS statistic
en_model <- sdm::ensemble(model_cv, newdata = pic_predictor, filename = 'ensemble_cv_thinm .tif',setting=list(method = 'weighted',stat = 'TSS', opt = 2))
en_model
class : RasterLayer
dimensions : 6839, 9625, 65825375 (nrow, ncol, ncell)
resolution : 1374.021, 1374.021 (x, y)
extent : -4129087, 9095868, -7277874, 2119058 (xmin, xmax, ymin, ymax)
crs : +proj=merc +lon_0=150 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
source : ensemble_cv_thinm .tif
names : ensemble_weighted
values : 0.005975644, 0.9654704 (min, max)
evalSDM(pic_train_df, as.data.frame(en_model))
Error in data.frame(ID = seq_len(length(observation)), obs = observation, :
arguments imply differing number of rows: 12, 275, 65825375
To clarify I followed the tutorial via: https://damariszurell.github.io/EEC-MGC/b7_SDM_ensembles.html#3_Making_ensembles on building ensembles and still obtained the same error. I could send the dataset if required but I thought just to ask in case anyone has run into this issue and has a solution to perform an evaluation on an ensembles sdm mode. Any help or advice would be appreciated.
The other code, following the tutorial via mecofun package to build the ensemble is below:
#build ensemble
wmean_prob_tss <- apply(pred_test_data, 1, weighted.mean,
w = comp_perf[names(pred_test_data), 'TSS'])
summary(wmean_prob_tss)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.005987 0.020673 0.056440 0.165822 0.219662 0.965392
(perf_mean_prob <- evalSDM(pic_train_df$presence, wmean_prob_tss))
Error in data.frame(ID = seq_len(length(observation)), obs = observation, :
arguments imply differing number of rows: 275, 6494019