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:
- Apple’s ‘Command Line Tools’: these can be (re-)installed by running
xcode-select --install
in a terminal. You may also check if those are already installed by runningpkgbuild::check_build_tools()
in R. - A Fortran compiler. Installers for gfortran are available
here.
This installs into
/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)
chain <- sampler_mh(start = 1, distr_name = "norm", distr_params = c(0,1), sigma_prop = diag(1) * .5, iterations = 2048)
r <- plot_series(chain[[1]], change = FALSE)
As well as tools to diagnose the patterns both from samplers and participants:
v <- calc_all(chain[[1]][1:200])