Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

stan_demo

Demonstrate examples included in Stan


Description

Stan includes a variety of examples and most of the BUGS example models that are translated into Stan modeling language. One example is chosen from a list created from matching user input and gets fitted in the demonstration.

Usage

stan_demo(model = character(0), 
            method = c("sampling", "optimizing", "meanfield", "fullrank"), ...)

Arguments

model

A character string for model name to specify which model will be used for demonstration. The default is an empty string, which prompts the user to select one the available models. If model = 0, a character vector of all models is returned without any user intervention. If model = i where i > 0, then the ith available model is chosen without user intervention, which is useful for testing.

method

Whether to call sampling (the default), optimizing, or one of the variants of vb for the demonstration

...

Further arguments passed to method.

Value

An S4 object of stanfit, unless model = 0, in which case a character vector of paths to available models is returned.

References

The Stan Development Team Stan Modeling Language User's Guide and Reference Manual. http://mc-stan.org/.

See Also

Examples

## Not run: 
     dogsfit <- stan_demo("dogs") # run the dogs model
     fit1 <- stan_demo(1) # run model_names[1]
  
## End(Not run)

rstan

R Interface to Stan

v2.21.2
GPL (>= 3)
Authors
Jiqiang Guo [aut], Jonah Gabry [aut], Ben Goodrich [cre, aut], Sebastian Weber [aut], Daniel Lee [ctb], Krzysztof Sakrejda [ctb], Modrak Martin [ctb], Trustees of Columbia University [cph], Oleg Sklyar [cph] (R/cxxfunplus.R), The R Core Team [cph] (R/pairs.R, R/dynGet.R), Jens Oehlschlaegel-Akiyoshi [cph] (R/pairs.R), John Maddock [cph] (gamma.hpp), Paul Bristow [cph] (gamma.hpp), Nikhar Agrawal [cph] (gamma.hpp), Christopher Kormanyos [cph] (gamma.hpp), Bronder Steve [ctb]
Initial release
2020-07-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.