Skip to contents

Setup

Wire flexstanr into your own package.

use_flexstanr()
Wire flexstanr into a host package

Fitting

Build sampler options and fit a model through the chosen backend.

stan_options()
Stan Sampler Options
fit_model()
Fit a Stan model through the chosen backend

Threading

Turn on scheduler-aware threading with stan_options(threading = TRUE); a host’s fit function checks whether threads were requested so it can warn on a model that cannot use them.

test_threaded()
Does a set of sampler options ask for within-chain threading?

Reading a fit

Backend-agnostic accessors for a fitted model object.

backend_draws_array()
Posterior draws of a fit as an iterations x chains x parameters array
backend_extract()
Extract parameters from a fit, in a chosen format
backend_generate_quantities()
Run generated quantities against a fit and return a parameter matrix
backend_has_draws()
Does a fit object carry usable posterior draws?