We can use Markov chains to sample pseudo absences in moderate dimensions. In the process we overcome limitations of the original paper, especially those related to a sampling grid, only two dimensions in the PCA space, and the hard cutoff threshold to exclude the presence species. The figure below shows an overview of the proposed method.
scheme of the proposed methodIt forks the USE package with the goal to extend it to enable MCMC sampling in higher dimensional spaces. The repo can be downloaded by using the following command in a terminal or downloading the repo as a zip file:
git clone https://github.com/Mdmdma/USE.MCMC.git
The package now ships a compiled C++ inner loop (Rcpp + RcppArmadillo),
so installing from source requires a working C++ toolchain: Rtools on
Windows, the Xcode Command Line Tools on macOS, or r-base-dev /
build-essential on Linux. From a clone of this repo:
# install.packages("devtools")
devtools::install_local(".")The vignette Insights on Markov chain based pseudo-absence sampling gives insights into the developed method, the vignette Insights on nearest neighbor search adds an explainer to the concept of using distance in the principal component space as a way to map fictional simulated points to real points in the environment. Both vignettes can be found on the GitHub Pages site.
We fit Gaussian mixture models (GMMs) to both the points of the environment and the model species in the PCA space of their environmental variables. From these GMMs we construct a function on which we run a Markov chain. The figure below displays the sampled function, the sampled species points as well as the sampled points in the space spanned by the first two principal components.
sampled points in the pc space overlaid over the sampled functionWe can show the sampled points in the geographic space.
Sampled points in the geographical spaceLooking at the density of the pc scores, we can see that our newly developed method enables the user to sample more dimensions uniformly. Whether this is beneficial to the downstream model depends on the amount of variability explained by the first two components.
posterior density of the first three principal componentsmcmcSampling() and paSamplingMcmc() accept an engine argument of
c("auto", "R", "cpp"). The default "auto" picks the C++ inner loop
whenever the density and proposal closures are built by the package’s
own factories (mclustDensityFunction() and addHighDimGaussian()),
which is what paSamplingMcmc() does internally. Custom user-supplied
closures continue to run on the R reference loop. Pass "R" to force
the reference path (useful for comparison) or "cpp" to require the C++
path.



