rstanadvi: ADVI variational inference from within R

Description Usage Arguments Value

Description

ADVI currently only implemented in cmdStan. This function provides a small wrapper round cmdStan enabling models to be built from within stan. This functionality should be eventually incorporated into rstan itself.

Usage

1
2
3
4
rstanadvi(stan_model_name, data, path_to_stanmodel = ".", init = NULL,
  path_to_cmdstan = "../cmdstan-2.9.0", data_file_name = "data.R",
  init_file_name = "init.R", output_file_name = paste0(stan_model_name,
  ".txt"))

Arguments

stan_model_name

The name of the stan model (i.e. the stan model file name without ".stan"). If ".stan" is found in the model name it is removed.

data

A named list of data, identical to what would be passed to stan.

path_to_stanmodel

The path (relative or absolute) to the stan model file

init

A named list of initial values for parameters. Note that since variational inference doesn't have chains, this is slightly different from stan and should just be a list of length number of parameters.

path_to_cmdstan

Relative or absolute path to installation of cmdstan.

data_file_name

Name of intermediate file to which data is dumped (optional).

init_file_name

Name of intermediate file to which initial values are dumped (optional).

output_file_name

Name of output file (optional).

Value

A data.frame containing one column for each parameter and a row for each of the posterior samples (default 1000).


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