Small R wrapper for variational inference in Stan
# install.packages("devtools")
devtools::install_github("kieranrcampbell/rstanadvi")
Install cmdStan to a directory (e.g. `../cmdstan-2.9.0').
As an example, say we're fitting a normal distribution to some data. We create a stan file in the current directory called gauss.stan
. We would then fit variational inference as follows:
x <- rnorm(100)
data <- list(N = length(x), x = x)
fit <- rstanadvi("gauss", data = data, path_to_cmdstan = "../cmdstan-2.9.0")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.