R {{category R}} !!! BRMS : Bayesian Regression Models using Stan {{outline}} ---- !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 という名前のフォルダーにインストールするようにする? ---- !brms {{pre 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