<- file.path(Sys.getenv("HOME"), ".R")
dotR if (!file.exists(dotR)) dir.create(dotR)
<- file.path(dotR, "Makevars")
M if (!file.exists(M)) file.create(M)
<- ifelse(R.version$arch == "aarch64", "arm64", "x86_64")
arch cat(paste("\nCXX14FLAGS += -O3 -mtune=native -arch", arch, "-ftemplate-depth-256"),
file = M, sep = "\n", append = FALSE)
How to Install rstan and brms
For Mac Users
- Make sure R is up-to-date > 4.2
- Configural C++ Toolchain
- Set up the C++ Toolchain using the macOS R toolchain installer
- To improve estimation speed, you can copy the following syntax to the R console
- To install
rstan
, in the R console- Remove all old
rstan
files, if they exist
- Remove all old
remove.packages("rstan")
if (file.exists(".RData")) file.remove(".RData")
- Restart R
- Install
StanHeaders
andrstan
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
- Verify installation (details)
remove.packages("rstan")
if (file.exists(".RData")) file.remove(".RData")
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
- Install brms (details)
install.packages("brms")
You’re all set!
For Windows Users
- Make sure R is up-to-date > 4.2
- Configural C++ Toolchain (follow steps for R 4.2)
- To install
rstan
, in the R console- Remove all old
rstan
files, if they exist
- Remove all old
remove.packages("rstan")
if (file.exists(".RData")) file.remove(".RData")
- Restart R
- Install
StanHeaders
andrstan
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
- Verify installation (details)
remove.packages("rstan")
if (file.exists(".RData")) file.remove(".RData")
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
- Install brms (details)
install.packages("brms")
You’re all set!