# walkr, monte carlo markov chain sampling of non-negative convex polytopes

To set up

library(walkr)
#> Registered S3 methods overwritten by 'ggplot2':
#>   method         from
#>   [.quosures     rlang
#>   c.quosures     rlang
#>   print.quosures rlang
#> Registered S3 method overwritten by 'xts':
#>   method     from
#>   as.zoo.xts zoo

# very straight forward sampling

A <- matrix(1, ncol = 3)
b <- 1
sampled_points <- walkr(A = A, b = b, points = 10,
method = "dikin", ret.format = "list") 

Consider the intersection of two spaces: the complete solution space to Ax = b and the N-simplex. The intersection of these two spaces is a non-negative convex polytope. The R package walkr samples from this intersection using two Monte-Carlo Markov Chain (MCMC) methods: hit-and-run (Kannan and Narayanan 2009) and Dikin walk (Vempala 2005). Walkr also provide tools to examine sample quality (Gabry 2015). MCMC sampling is of great interest in applied statistics, as it is a common approach to sample data drawn from a theoretical distribution (Gelman and Rubin 1992). In application, walkr will be a powerful tool for estimating expectations for Bayesian statistics. The walkr package will also be found useful by users who are interested in generating random weight vectors in high dimensions given specific constraints. The real world application to MCMC sampling is vast. In the context of finance, we’ve had users use walkr to generate random portfolios satisfying specific constraints. We’ve also had users use walkr to sample from solution spaces obtained empirically from mass spectrometry analysis of proteins, which can provide insight into the biological systems of interest. Finally, walkr is one of the first open-sourced softwares to implement the Dikin walk.

https://github.com/andyyao95/walkr/blob/master/vignettes/walkr.pdf contains a more detailed description of the package.