*disclaimer
1196944
BRMS : Bayesian Regression Models using Stan
Windows x Rstudio x rStan のバージョンの問題で、パスがうまく通らない。
'C:/RTOOLS/usr/mingw_/bin/g++' not found エラー: sh: C:/RTools/mingw_64/bin/g++: No such file
https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started
- そもそも Rtools 4.0をインストールする際に、
- C:\rtools40 ではなくて
- C:\rtools という名前のフォルダーにインストールするようにする?
- Rのバージョンは4.0.2以上に上げないといけない
- それより前だと上のようになる模様
- Rtoolsのインストールの確認
Sys.which("make")
- パスの設定
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
- システム環境変数の設定
https://github.com/CLRafaelR/lingdocdown/blob/main/manuals/guide-installation-R-tinytex.pdf
brms
library(rstan) library(brms) モデル <- brm(目的変数 ~ 説明変数, family=gaussian (link="identity"), データ, seed=1 ) plot(モデル) 効果 <- marginal_effects(モデル, method = "predict") plot(効果, points=T)
- link関数はデフォルトで良ければ書かなくてよい。
Reference
馬場 (2019) RとStanではじめるベイズ統計モデリングによるデータ分析入門. 講談社.
https://github.com/logics-of-blue/book-r-stan-bayesian-model-intro
https://sugiura-ken.org/wiki/