Why do I get different outputs each time I run the thin() function from the package spThin?
I am trying to thin some occurrence data in order to reduce sampling bias in my presence-only dataset for use in maxent models as follows:
library(spThin)
thinned_dataset_full.100.1 <- thin(loc.data = AP.bioclim.combined.3, lat.col = "Latitude", long.col = "Longitude", spec.col = "Species", thin.par = 5, reps = 100, locs.thinned.list.return = TRUE, write.files = FALSE, write.log.file = FALSE)
Beginning Spatial Thinning.
Script Started at: Wed Jun 17 17:02:32 2026
lat.long.thin.count
1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1206
2 6 4 11 6 20 17 14 7 6 6 1
[1] "Maximum number of records after thinning: 1206"
[1] "Number of data.frames with max records: 1"
[1] "No files written for this run."
I have noticed that when I run the code several times on the same dataset the resulting output differs each time e.g.
#Attempt 2
library(spThin)
thinned_dataset_full.100.2 <- thin(loc.data = AP.bioclim.combined.3, lat.col = "Latitude", long.col = "Longitude", spec.col = "Species", thin.par = 5, reps = locs.thinned.list.return = TRUE, write.files = FALSE, write.log.file = FALSE)
Beginning Spatial Thinning.
Script Started at: Wed Jun 17 17:04:03 2026
lat.long.thin.count
1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206
1 4 4 3 12 12 13 13 9 12 5 9 2 1
[1] "Maximum number of records after thinning: 1206"
[1] "Number of data.frames with max records: 1"
[1] "No files written for this run."
#Attempt 3
library(spThin)
thinned_dataset_full.100.3 <- thin(loc.data = AP.bioclim.combined.3, lat.col = "Latitude", long.col = "Longitude", spec.col = "Species", thin.par = 5, reps = 100, locs.thinned.list.return = TRUE, write.files = FALSE, write.log.file = FALSE)
Beginning Spatial Thinning.
Script Started at: Wed Jun 17 17:06:25 2026
lat.long.thin.count
1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1206
1 1 5 5 11 11 15 17 12 11 4 4 3
[1] "Maximum number of records after thinning: 1206"
[1] "Number of data.frames with max records: 3"
[1] "No files written for this run."
Could anyone please explain to me why this is and how I can go about deciding which output I should interpret?