The goal of samplr is to provide tools to understand human performance from the perspective of sampling, both looking at how people generate samples and how people use the samples they have generated. A longer overview and other resources can be found at sampling.warwick.ac.uk.
You can install samplr from CRAN:
install.packages("samplr")
or install the development version from Github with:
devtools::install_github("lucas-castillo/samplr")
or alternatively using the remotes
package
remotes::install_github("lucas-castillo/samplr")
If you are installing the development version on MacOS, you will need the following prior to installation:
xcode-select --install
in a terminal. You may also check if
those are already installed by running
pkgbuild::check_build_tools()
in
/usr/local/gfortran
.Read more about it on the macOS Prerequisites section in the R Installation and Administration Manual.
If you are installing the development version on Windows, you will need to have RTools installed, which you can find here. Please make sure you install the version corresponding to your R version (i.e. for R 4.3.3, you’d need RTools 4.3).
The samplr package provides tools to generate samples following particular algorithms
library(samplr)
set.seed(1)
<- sampler_mh(start = 1, distr_name = "norm", distr_params = c(0,1), sigma_prop = diag(1) * .5, iterations = 2048)
chain <- plot_series(chain[[1]], change = FALSE) r
As well as tools to diagnose the patterns both from samplers and participants:
<- calc_all(chain[[1]][1:200]) v