abund <- c(10,20,50,100)
sim1 <- sim_thomas_coords(abund, sigma = 0.02)
plot(sim1)
# Simulate species "ranges"
sim2 <- sim_thomas_coords(abund, sigma = 0.02, mother_points = 1)
plot(sim2)
# Equal numbers of points per cluster
sim3 <- sim_thomas_coords(abund, sigma = 0.02, cluster_points = 5)
plot(sim3)
# With large sigma the distribution will be essentially random (see Details)
sim4 <- sim_thomas_coords(abund, sigma = 10)
plot(sim4)
# Some random and some clustered species with different numbers of mother points.
mother_points <- sample(0:3, length(abund), replace = TRUE)
sim5 <- sim_thomas_coords(abund, mother_points = mother_points, sigma=0.01)
plot(sim5)
# Specifying mother point coordinates or no-clustering (\code{NA}).
mother_points <- sample(1:3, length(abund), replace = TRUE)
xmother <- lapply(1:length(abund), function(i) runif(mother_points[i], 0, 1))
ymother <- lapply(1:length(abund), function(i) runif(mother_points[i], 0, 1))
xmother[[1]] <- NA
ymother[[1]] <- NA
sim6 <- sim_thomas_coords(abund, xmother=xmother, ymother=ymother, sigma=0.01)
plot(sim6)
# Species having different ranges.
xrange <- data.frame(t(sapply(1:length(abund), function(i) sort(runif(2, 0, 1)))))
yrange <- data.frame(t(sapply(1:length(abund), function(i) sort(runif(2, 0, 1)))))
sim7 <- sim_thomas_coords(abund, mother_points=1, sigma=1, xrange=xrange, yrange=yrange)
plot(sim7)
Run the code above in your browser using DataLab