rstan: RStan - the R interface to Stan

Description Other R packages from the Stan Development Team Author(s) See Also Examples

Description

mc-stan.org Stan Development Team

RStan is the R interface to the Stan C++ package. The RStan interface (rstan R package) provides:

For documentation on Stan itself, including the manual and user guide for the modeling language, case studies and worked examples, and other tutorial information visit the Users section of the Stan website:

Other R packages from the Stan Development Team

Various related R packages are also available from the Stan Development Team:

Package Description Doc Website
bayesplot ggplot-based plotting of parameter estimates, diagnostics, and posterior predictive checks. bayesplot-package mc-stan.org/bayesplot
shinystan Interactive GUI for exploring MCMC output. shinystan-package mc-stan.org/shinystan
loo Out-of-sample predictive performance estimates and model comparison. loo-package mc-stan.org/loo
rstanarm R formula interface for applied regression modeling. rstanarm-package mc-stan.org/rstanarm
rstantools Tools for developers of R packages interfacing with Stan. rstantools-package mc-stan.org/rstantools

Author(s)

Jonah Gabry (author) <[email protected]>
Ben Goodrich (maintainer, author) <[email protected]>
Jiqiang Guo (author) <[email protected]>

There are also many other important contributors to RStan (github.com/rstan). Please use 'Stan Development Team' whenever citing the R interface to Stan. A BibTex entry is available from http://mc-stan.org/rstan/authors or citation("rstan").

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Not run:  

stanmodelcode <- "
data {
  int<lower=0> N;
  real y[N];
} 

parameters {
  real mu;
} 

model {
  target += normal_lpdf(mu | 0, 10);
  target += normal_lpdf(y  | mu, 1);
} 
"

y <- rnorm(20) 
dat <- list(N = 20, y = y); 
fit <- stan(model_code = stanmodelcode, model_name = "example", 
            data = dat, iter = 2012, chains = 3, sample_file = 'norm.csv',
            verbose = TRUE) 
print(fit)

# extract samples 
e <- extract(fit, permuted = FALSE) # return a list of arrays 
str(e)

arr <- as.array(fit) # return an array 
str(arr)

mat <- as.matrix(fit) # return a matrix
str(mat)

## End(Not run)

rstan documentation built on Nov. 8, 2018, 1:04 a.m.