R Interface to Stan

User-facing R functions are provided to parse, compile, test, estimate, and analyze Stan models by accessing the header-only Stan library provided by the 'StanHeaders' package. The Stan project develops a probabilistic programming language that implements full Bayesian statistical inference via Markov Chain Monte Carlo, rough Bayesian inference via 'variational' approximation, and (optionally penalized) maximum likelihood estimation via optimization. In all three cases, automatic differentiation is used to quickly and accurately evaluate gradients without burdening the user with the need to derive the partial derivatives.


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rstan")

2.32.7 by Ben Goodrich, 2 years ago


https://mc-stan.org/rstan/, https://discourse.mc-stan.org


Report a bug at https://github.com/stan-dev/rstan/issues/


Browse source code at https://github.com/cran/rstan


Authors: Jiqiang Guo [aut] , Jonah Gabry [aut] , Ben Goodrich [cre, aut] , Andrew Johnson [aut] , Sebastian Weber [aut] , Hamada S. Badr [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]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports methods, stats4, inline, gridExtra, Rcpp, RcppParallel, loo, pkgbuild, QuickJSR, ggplot2

Depends on StanHeaders

Suggests testthat, parallel, KernSmooth, shinystan, bayesplot, rmarkdown, rstantools, rstudioapi, Matrix, knitr, coda, V8

Linking to Rcpp, RcppEigen, BH, StanHeaders, RcppParallel

System requirements: GNU make, pandoc


Imported by AovBay, BINtools, BPrinStratTTE, BRRAT, BSET, BayesGP, BayesGmed, BayesGrowth, BayesPET, BayesRE, BayesSenMC, BayesianFitForecast, BeeGUTS, Bernadette, BinaryReplicates, BoundIRT, CARME, CLRtools, CNVRG, CRTspat, CausalQueries, DCPO, EcoEnsemble, EloSteepness, EpiNow2, EpiPvr, FlexReg, ForceChoice, GMLTM, GUD, HHBayes, HTDV, HeckmanStan, HuraultMisc, LMMELSM, MCMCvis, MIRES, MetaStan, MultiNMix, OncoBayes2, PStrata, PoolTestR, ProbBreed, PublicationBiasBenchmark, R2D2ordinal, RBesT, Rlgt, RoBTT, SLGP, SMNlmec, SSNbayes, StanMoMo, SteadyStateBVAR, TriDimRegression, ValidationExplorer, WSPsignal, WhiteLabRt, YPBP, YPPE, ZIHINAR1, adjustr, adnuts, autoFC, baggr, bakR, baldur, bayclumpr, bayes4psy, bayesDiagnostics, bayesZIB, bayesdfa, bayesforecast, bayeslist, bbmix, bclogit, beastt, bellreg, bennu, bin2norm, bistablehistory, bkmrhat, blavaan, bmgarch, bmggum, bmlm, bmstdr, bnns, bqmm, breathteststan, brms, brxx, bscm, bsitar, bsynth, bws, catalytic, cbq, cloneRate, conStruct, ctsem, dclone, dcvar, densEstBayes, disbayes, dynamite, eDNAjoint, eggCounts, epidist, expertsurv, fcirt, fkbma, flps, footBayes, gastempt, geostan, glmmPen, glmmfields, greencrab.toolkit, hbamr, historicalborrowlong, hmde, hsstan, hwep, imt, imuGAP, intervalpsych, isotracer, ivd, jfa, lgpr, measr, metaBMA, miniLNM, mlts, mlumr, morseTKTD, mrbayes, multinma, multipleDL, mvgam, neodistr, networkscaleup, parTimeROC, pcFactorStan, pema, phacking, phylopairs, pivmet, postlink, prome, prophet, psBayesborrow, publipha, rACMEMEEV, rPBK, rater, rbioacc, rcbayes, refundBayes, rmBayes, rmdcev, rmsb, rmstBayespara, rstanarm, rstanbdp, rstanemax, rts2, saeHB.TF.beta, serofoi, serosv, shinybrms, shinystan, shrinkr, spacemodR, spsurv, ssMousetrack, surveil, survextrap, survstan, svyLocAdj, thurstonianIRT, tipsae, trialr, truncnormbayes, tsnet, ubms, vacalibration, winputall, zoid.

Depended on by BayesianPlatformDesignTimeTrend, DrBats, GPP, GPRMortality, JMbayes, MADPop, MIXFIM, RStanTVA, bayesvl, clinDR, edstan, psrwe, tmbstan, walker.

Suggested by BayesERtools, BayesForge, BayesPostEst, BayesTools, BayesVolcano, BayesianDisaggregation, BayesianLasso, DAST, EconCausal, EpiNova, HRW, LocaTT, PosteriorBootstrap, SSRTcalc, SoupX, StanHeaders, alien, bayesImageS, bayesian, bayesianOU, bayesnec, bayesplot, bayestestR, birdie, bridgesampling, brms.mmrm, broom.mixed, cdtmbnma, compareMCMCs, convergenceDFM, finalfit, flexstanr, flocker, gp3bayes, hbsaems, hmmTMB, hobbs, idealstan, insight, loo, lorad, makemyprior, metabias, mice, modeltime, mpower, nlmixr2est, parameters, pcvr, postpack, priorsense, rbmi, rbmiUtils, rjuliabugs, rstantools, runMCMCbtadjust, salmonMSE, socialSim, spicy, survHE, swfscMisc, tidyILD, tidybayes, tidyposterior, unifed.

Enhanced by DHARMa, dsem, mrregression.


See at CRAN