diff --git a/README.md b/README.md index f307ea4..3e9df73 100644 --- a/README.md +++ b/README.md @@ -41,18 +41,18 @@ source('ex1.R') | ソフトやパッケージ名 | 執筆時点 | サポートページ内の現状 | |:-----------|:------------|:------------| | OS | Windows 7 SP1 (64bit) | Windows 7 SP1 (64bit) | -| R | 3.3.1 | 3.3.1 | -| Rtools | Rtools34 | Rtools34 | -| Stan | 2.11 | 2.14 | -| rstan | 2.11.1 | 2.14.2 | -| ggplot | 2.1.0 | 2.2.1 | +| R | 3.3.1 | 3.5.1 | +| Rtools | Rtools34 | Rtools35 | +| Stan | 2.11 | 2.18 | +| rstan | 2.11.1 | 2.18.1 | +| ggplot | 2.1.0 | 3.1.0 | | ggmcmc | 1.1 | 1.1 | -| GGally | 1.1.0 | 1.3.0 | -| ellipse | 0.3.8 | 0.3.8 | -| hexbin | 1.27.1 | 1.27.1 | -| ggtern | 2.1.1 | 2.2.0 | -| mvtnorm | 1.0.5 | 1.0.5 | -| bda | 5.1.6 | 5.1.6 | -| gtools | 3.5.0 | 3.5.0 | -| Nippon | 0.6.3.1 | 0.6.3.1 | -| ggrepel | 0.5 | 0.6.5 | +| GGally | 1.1.0 | 1.4.0 | +| ellipse | 0.3.8 | 0.4.1 | +| hexbin | 1.27.1 | 1.27.2 | +| ggtern | 2.1.1 | 3.0.0 | +| mvtnorm | 1.0.5 | 1.0.8 | +| bda | 5.1.6 | 10.1.9 | +| gtools | 3.5.0 | 3.8.1 | +| Nippon | 0.6.3.1 | 0.7.1 | +| ggrepel | 0.5 | 0.8.0 | diff --git a/chap04/fig4-7.R b/chap04/fig4-7.R index 1191a58..8e3e438 100644 --- a/chap04/fig4-7.R +++ b/chap04/fig4-7.R @@ -37,8 +37,8 @@ g1 <- cbind(g_x, g_emp, size='first') g2 <- cbind(g_xy, g_y, size='first') g <- rbind(g1, g2, size='first') g$widths[1:3] <- grid::unit.pmax(g1$widths[1:3], g2$widths[1:3]) -g$heights[7:12] <- g$widths[5:10] <- rep(unit(0.5,'mm'), 6) -g$heights[6] <- g$widths[11] <- unit(3,'cm') +g$heights[8:13] <- g$widths[6:11] <- rep(unit(0.5,'mm'), 6) +g$heights[7] <- g$widths[14] <- unit(3,'cm') png(file='output/fig4-7.png', res=300, w=1800, h=1800) grid::grid.draw(g) diff --git a/chap06/fig6-12.R b/chap06/fig6-12.R index 80609d5..0ecb7e3 100644 --- a/chap06/fig6-12.R +++ b/chap06/fig6-12.R @@ -20,9 +20,9 @@ plot.multinormal <- function(file) { g_xy <- ggplotGrob(p_xy) g_x <- ggplotGrob(p_x) g <- rbind(g_x, g_xy, size='first') - g$widths[1:3] <- grid::unit.pmax(g1$widths[1:3], g2$widths[1:3]) - g$heights[7:12] <- rep(unit(0.3,'mm'), 6) - g$heights[6] <- unit(2,'cm') + g$widths[1:3] <- grid::unit.pmax(g_xy$widths[1:3], g_x$widths[1:3]) + g$heights[8:13] <- rep(unit(0.3,'mm'), 6) + g$heights[7] <- unit(2,'cm') png(file=file, res=300, w=1200, h=1400) grid::grid.draw(g) diff --git a/chap06/fig6-6.R b/chap06/fig6-6.R index 29f16a2..0ad2d4f 100644 --- a/chap06/fig6-6.R +++ b/chap06/fig6-6.R @@ -5,7 +5,7 @@ lab_seq <- seq(from=0.2, to=1, by=0.2) plot.tern <- function(d, file) { p <- ggtern(data=d, aes(x=z, y=y, z=x)) - p <- p + theme_bw(base_size=18, base_family='serif') + p <- p + theme_bw(base_size=18, base_family='serif') + theme_latex(value=TRUE) p <- p + theme( plot.margin=margin(-5,-5,-5,-5,'mm'), tern.axis.line=element_line(color=gray(0.2)), diff --git a/chap08/run-model8-6.R b/chap08/run-model8-6.R index 84efaaf..185501d 100644 --- a/chap08/run-model8-6.R +++ b/chap08/run-model8-6.R @@ -6,6 +6,6 @@ K <- 30 G <- 3 K2G <- unique(d[ , c('KID','GID')])$GID data6 <- list(N=N, G=G, K=K, X=d$X, Y=d$Y, KID=d$KID, GID=d$GID, K2G=K2G) -fit6 <- stan(file='model/model8-6.stan', data=data6, seed=123) +fit6 <- stan(file='model/model8-6.stan', data=data6, seed=12345) save.image('output/result-model8-6.RData') diff --git a/chap12/fig12-10-left.R b/chap12/fig12-10-left.R index 81de8cf..fffd57c 100644 --- a/chap12/fig12-10-left.R +++ b/chap12/fig12-10-left.R @@ -1,4 +1,5 @@ library(Nippon) +library(NipponMap) d <- read.csv('input/data-map-temperature.txt') d$Y[d$Y > 19] <- 19 @@ -7,5 +8,5 @@ cols <- lattice::level.colors( col.regions=colorRampPalette(RColorBrewer::brewer.pal(9,'Greys'))(100) ) png('output/fig12-10-left.png', w=800, h=600) -JapanPrefecturesMap(col=cols) +JapanPrefMap(col=cols) dev.off() diff --git a/chap12/fig12-10-right.R b/chap12/fig12-10-right.R index 43176a8..a67c92b 100644 --- a/chap12/fig12-10-right.R +++ b/chap12/fig12-10-right.R @@ -1,4 +1,5 @@ library(Nippon) +library(NipponMap) load('output/result-model12-14.RData') ms <- rstan::extract(fit) @@ -9,5 +10,5 @@ cols <- lattice::level.colors( col.regions=colorRampPalette(RColorBrewer::brewer.pal(9,'Greys'))(100) ) png('output/fig12-10-right.png', w=800, h=600) -JapanPrefecturesMap(col=cols) +JapanPrefMap(col=cols) dev.off() diff --git a/chap12/fig12-11.R b/chap12/fig12-11.R index 641a48c..2bf0b54 100644 --- a/chap12/fig12-11.R +++ b/chap12/fig12-11.R @@ -17,8 +17,8 @@ p <- ggplot.obspred(data=d_est, xylim=c(9, 24), size=0.8) p <- p + geom_label_repel( data=d_all[top3_diff, ], aes(label=name), box.padding=grid::unit(2, 'lines'), - nudge_x=ifelse(d_all[top3_diff, ]$diff > 0, 2, -2), - nudge_y=ifelse(d_all[top3_diff, ]$diff > 0, -1, 1) + nudge_x=ifelse(d_all[top3_diff, ]$diff > 0, 4, -3), + nudge_y=ifelse(d_all[top3_diff, ]$diff > 0, -2, 3) ) p <- p + labs(x='Observed', y='Predicted') p <- p + scale_x_continuous(breaks=seq(0, 25, 5)) diff --git a/chap12/run-model12-14.R b/chap12/run-model12-14.R index 877789d..de191c1 100644 --- a/chap12/run-model12-14.R +++ b/chap12/run-model12-14.R @@ -7,7 +7,7 @@ data <- list(N=N, Y=d$Y, I=nrow(d2), From=d2$From, To=d2$To) stanmodel <- stan_model(file='model/model12-14.stan') fit <- sampling( - stanmodel, data=data, seed=1234, + stanmodel, data=data, seed=1, init=function() { list(r=d$Y, s_r=1, s_Y=0.1) } ) diff --git a/chap12/run-model12-2.R b/chap12/run-model12-2.R index dcbfd3c..5155b40 100644 --- a/chap12/run-model12-2.R +++ b/chap12/run-model12-2.R @@ -6,6 +6,6 @@ T_pred <- 3 data <- list(T=T, T_pred=T_pred, Y=d$Y) stanmodel <- stan_model(file='model/model12-2.stan') fit <- sampling(stanmodel, data=data, pars=c('mu_all', 's_mu', 's_Y'), - iter=4000, thin=5, seed=1234) + iter=4000, thin=5, seed=123) save.image('output/result-model12-2.RData') diff --git a/chap12/run-model12-6.R b/chap12/run-model12-6.R index 81b0913..0cc407b 100644 --- a/chap12/run-model12-6.R +++ b/chap12/run-model12-6.R @@ -4,10 +4,10 @@ d <- read.csv('input/data-ss2.txt') T <- nrow(d) data <- list(T=T, Y=d$Y) stanmodel <- stan_model(file='model/model12-6.stan') -fit <- sampling(stanmodel, data=data, iter=4000, thin=5, seed=1234) +fit <- sampling(stanmodel, data=data, iter=4000, thin=5, seed=1) save.image('output/result-model12-6.RData') stanmodel_b <- stan_model(file='model/model12-6b.stan') fit_b <- sampling(stanmodel_b, data=data, - pars=c('mu', 'season', 's_mu', 's_season', 's_Y', 'y_mean'), iter=4000, thin=5, seed=1234) + pars=c('mu', 'season', 's_mu', 's_season', 's_Y', 'y_mean'), iter=4000, thin=5, seed=123) diff --git a/update.md b/update.md index ef7e636..9d77249 100644 --- a/update.md +++ b/update.md @@ -1,4 +1,4 @@ -### 2.15 → 2.17 +### 2.15 → 2.18 特にありません. ### 2.14.2 → 2.15