--
You received this message because you are subscribed to the Google Groups "spOccupancy and spAbundance users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spocc-spabund-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/spocc-spabund-users/982483f8-c346-4b2a-949d-f8926fd175a7n%40googlegroups.com.
Hello Jeff, thanks for the reply. Indeed is a very large area. Because we wanted to use the results of our ecological models to predict species occurrence across the entire area of interest, we generated a grid of hexagons with an internal area of 3.14 hectares across the entire study area.
Comparing your code with mine, I think that we are both doing the same approach. I used chunks to split the data and perform the predictions:
chunk_size <- 200 # Number of hexagons
num_chunks <- ceiling(nrow(hex_cov) / chunk_size)
n.omp.threads <- 5
predictions <- list()
for (i in 1:num_chunks) {
start_row <- (i - 1) * chunk_size + 1
end_row <- min(i * chunk_size, nrow(hex_cov))
hex_cov_chunk <- hex_cov[start_row:end_row, ]
coords_chunk <- coords.0[start_row:end_row, ]
pred_chunk <- predict(
out_bestmodel,
hex_cov_chunk,
coords_chunk,
n.omp.threads = n.omp.threads
)
predictions[[i]] <- pred_chunk
# Clear memory
rm(pred_chunk)
gc()
}
# Combine predictions from all chunks
out_pred <- do.call(rbind, predictions)
But, this is not working yet, and I don't know why. Indeed I used a big sample size to run the models:
Samples per Chain: 125000
Burn-in: 100000
Thinning Rate: 25
Number of Chains: 3
Total Posterior Samples: 3000
I will keep trying different approaches here. If I get something working I keep you informed.
Thank you so much.
Hello Jeff,
I hope you're doing well. I wanted to provide you with an update and seek your help once again.
I ran the code following the same approach as yours, but it seems that the prediction maps are not being constructed correctly. We believe this issue is related to how we calculated the predictions using chunks.
Since this is a model with a spatial component, each time a chunk is processed and the previous one is cleared, it seems that the spatial component might be restarting (possibly) randomly from that new chunk. This is causing a wave-like effect in the prediction maps, where the waves correspond to the chunks. Due to the aggregation of points in certain regions, the spatial part of the model appears to be overly dominant compared to the environmental part.
I'm attaching one of the maps produced and the the code used to generate the predictions is at the end of this e-mail.
I hope there’s an alternative solution for this, and I’m curious to hear your thoughts on the matter.
Once again, thank you so much for your help.
Best regards,
Thiago
To view this discussion on the web visit https://groups.google.com/d/msgid/spocc-spabund-users/991fac06-6cce-4e99-9597-4a49466ff128n%40googlegroups.com.