README.md

rstanadvi

Small R wrapper for variational inference in Stan

Installation

# install.packages("devtools")
devtools::install_github("kieranrcampbell/rstanadvi")

Usage

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")


kieranrcampbell/rstanadvi documentation built on May 20, 2019, 9:40 a.m.