stanが導入出来ない
いろいろ参照してます
http://qh73xe.jimdo.com/r%E3%81%AE%E5%9F%BA%E6%9C%AC/r%E3%81%AE%E4%BE%BF%E5%88%A9%E3%81%AA%E9%96%A2%E9%80%A3%E3%82%BD%E3%83%95%E3%83%88/rtools/
http://tjo.hatenablog.com/entry/2013/10/04/190701
https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started
source('http://mc-stan.org/rstan/install.R', echo = TRUE, max.deparse.length = 2000) install_rstan()
公式のこのやり方でやろうとしたらまずdevtoolsがないと言われたのでインストール
また試みたらrtoolsがないと言われたのでインストール
http://cran.r-project.org/bin/windows/Rtools/
http://qh73xe.jimdo.com/r%E3%81%AE%E5%9F%BA%E6%9C%AC/r%E3%81%AE%E4%BE%BF%E5%88%A9%E3%81%AA%E9%96%A2%E9%80%A3%E3%82%BD%E3%83%95%E3%83%88/rtools/
ここがrtoolsのインストールの参考になります
でまた試みたらBHがない
でもBHは確かにインストールしてるのでここで詰まりました
あーでもないこーでもないといろいろやってダメだったのでググったら
https://groups.google.com/forum/#!msg/stan-users/lGIMXJf5P04/MvIRHzpTLh4J
これが出てきて解決しました
devtools::install_url("http://cran.r-project.org/src/contrib/Archive/BH/BH_1.55.0-3.tar.gz") devtools::install_url("https://github.com/stan-dev/rstan/releases/download/v2.6.0/rstan_2.6.0.tar.gz") library(rstan) set_cppo("fast")
さすがグーグル先生です
データ解析のための統計モデリング入門7章
> d4 <- d7[d7$x == 4,] #葉数4のサブセット > table(d4$y) #生存数がyiだった個体をカウント 0 1 2 3 4 5 6 7 8 3 1 4 2 1 1 2 3 3 > c(mean(d4$y), var(d4$y)) #平均と分散 [1] 4.050000 8.365789 > library(glmmML) > glmmML(cbind(y, N - y) ~ x, data = d7, family = binomial, cluster = id) #glmmMLを使う Call: glmmML(formula = cbind(y, N - y) ~ x, family = binomial, data = d7, cluster = id) coef se(coef) z Pr(>|z|) (Intercept) -4.190 0.8777 -4.774 1.81e-06 x 1.005 0.2075 4.843 1.28e-06 Scale parameter in mixing distribution: 2.408 gaussian Std. Error: 0.2202 LR p-value for H_0: sigma = 0: 2.136e-55 Residual deviance: 269.4 on 97 degrees of freedom AIC: 275.4