In addition to the simulation and
analysis of spatially-explicit communities, mobsim
provides
a function to generate samples from simulated or observed communities.
The combination of simulated data AND simulated sampling is a powerful
approach to test the validity and power of empirical approaches.
Here, we simulate a community and then generate samples with the
function sample_quadrats
. By default
sample_quadrats
distributes a user-defined number of
quadrats with user-defined size in the landscape and provides the number
of individuals for each species in each quadrat.
The function returns two dataframes. The first includes the abundance of every species in every sampling quadrat and the second the positions of the lower left corners of the quadrats.
The community matrix of samples by species can then be analysed using
additional software. For instance the R package vegan is perfectly
suited for the analysis of community data. See the vignette
Introduction to mobsim
for a worked
example.
## species_001 species_002 species_003 species_004 species_005 species_006
## site1 5 10 10 5 7 4
## site2 15 13 12 8 2 3
## site3 9 5 7 2 5 1
## site4 12 9 6 3 5 6
## site5 12 6 9 7 3 3
## site6 13 14 12 9 5 6
## x y
## site1 0.03057571 0.50679655
## site2 0.23702204 0.57027160
## site3 0.61718145 0.71268874
## site4 0.03628942 0.79279954
## site5 0.40773927 0.04984309
## site6 0.38057371 0.87181120
In sample_quadrats()
there is an option to exclude
overlapping quadrats from the random sampling design, which is shown
here in two examples with different numbers and sizes of the
quadrats.
In addition to random designs also transects can be sampled-. This requires specifying a position for the lower left quadrat as well as x and y distances between neighbouring quadrats.
Finally, sampling quadrats can be arranged in a regular lattice. For this design users have to choose distances among the quadrats in x and y dimension as shown in the example.
sample6 <- sample_quadrats(sim_com1, n_quadrats = 25, quadrat_area = 0.005,
method = "grid", x0 = 0, y0 = 0, delta_x = 0.1,
delta_y = 0.1)
sample7 <- sample_quadrats(sim_com1, n_quadrats = 25, quadrat_area = 0.005,
method = "grid", x0 = 0.05, y0 = 0.05, delta_x = 0.2,
delta_y = 0.2)
By default, sample_quadrats()
plots the chosen design.
However, the plotting can be also deactivated for more efficient
computations:
sample7a <- sample_quadrats(sim_com1, n_quadrats = 25, quadrat_area = 0.005,
method = "grid", x0 = 0.05, y0 = 0.05, delta_x = 0.2,
delta_y = 0.2, plot = FALSE)
head(sample7a$spec_dat[,1:10])
## species_001 species_002 species_003 species_004 species_005 species_006
## site1 3 4 4 1 3 3
## site2 6 5 9 2 2 2
## site3 6 4 5 4 2 4
## site4 6 2 2 3 3 2
## site5 5 3 2 1 1 2
## site6 4 3 6 3 8 1
## species_007 species_008 species_009 species_010
## site1 2 0 0 3
## site2 3 1 4 2
## site3 5 2 0 1
## site4 4 1 3 4
## site5 2 0 2 1
## site6 1 3 2 2