ropensci / NLMR

📦 R package to simulate neutral landscape models 🏔
https://ropensci.github.io/NLMR/
65 stars 17 forks source link

nlm_gaussianfield doesn't work properly #74

Closed immaryw closed 2 years ago

immaryw commented 3 years ago

Hello! I used the parameter autocorr_range of nlm_gaussianfield function to set different max range but get very similar results (especially x.3,x.4,x.5,x.6 in the plot below). Does "autocorr_range" work properly?

x.1 <- nlm_gaussianfield(ncol=50, nrow=50, autocorr_range=5,user_seed=2021) 
x.2 <- nlm_gaussianfield(ncol=50, nrow=50, autocorr_range=10,user_seed=2021) 
x.3 <- nlm_gaussianfield(ncol=50, nrow=50, autocorr_range=20,user_seed=2021) 
x.4 <- nlm_gaussianfield(ncol=50, nrow=50, autocorr_range=30,user_seed=2021) 
x.5 <- nlm_gaussianfield(ncol=50, nrow=50, autocorr_range=40,user_seed=2021) 
x.6 <- nlm_gaussianfield(ncol=50, nrow=50, autocorr_range=50,user_seed=2021) 
varstack <- stack(x.1,x.2,x.3,x.4,x.5,x.6)
names(varstack) <- c("x.01","x.02","x.03","x.04","x.05","x.06")
show_landscape(varstack,n_col=3)

produce

image

Thanks!

z3tt commented 3 years ago

Hi, thanks for using our package. The autocorr_range argument works as expected but you can't see any changes because your extent is too low. Here is the same code, but with landscapes consisting of 5000x5000 cells.

Rplot

Consider decreasing the autocorr_range input, e.g. start with .1 and end with 20.

immaryw commented 3 years ago

Thanks for your reply! I also tried the extent 500*500, max_lag=5,10,20,30,40,50. The last four plots still look pretty similar. Looks like when max_lag w.r.t extent grows to a certain point, the spatial structure pattern may not change anymore. In the example you gave, the ratio of max_lag/extent is very low, so the spatial structure patterns look different from each other. Can you please explain why?

z3tt commented 3 years ago

I did not write that code bit so I am not able to explain the exact reason why the algorithm behaves like this. What are you aiming for? If you want to have different landscape setups in terms of clustering, why not either increase the extent of the landscape or decrease max_lag?