Skip to content

Commit e812ff8

Browse files
committed
turn of vignettes on travis again
1 parent 28862b7 commit e812ff8

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ cache: packages
66

77
r_github_packages:
88
- r-lib/covr
9-
10-
# r_build_args: '--no-build-vignettes'
11-
# r_check_args: '--ignore-vignettes'
9+
10+
r_build_args: '--no-build-vignettes'
11+
r_check_args: '--ignore-vignettes'
1212

1313
before_install:
1414
- mkdir -p ~/.R

vignettes/visual-mcmc-diagnostics.Rmd

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ schools_mod_ncp <- stan_model("schools_mod_ncp.stan")
153153
We then fit the model by calling Stan's MCMC algorithm using the `sampling`
154154
function (the increased `adapt_delta` param is to make the sampler a bit more "careful" and avoid false positive divergences),
155155
```{r, fit-models-hidden, results='hide', message=FALSE}
156-
fit_cp <- sampling(schools_mod_cp, data = schools_dat, seed = 803214054, control = list(adapt_delta = 0.95))
157-
fit_ncp <- sampling(schools_mod_ncp, data = schools_dat, seed = 457721433, control = list(adapt_delta = 0.95))
156+
fit_cp <- sampling(schools_mod_cp, data = schools_dat, seed = 803214053, control = list(adapt_delta = 0.9))
157+
fit_ncp <- sampling(schools_mod_ncp, data = schools_dat, seed = 457721433, control = list(adapt_delta = 0.9))
158158
```
159159
and extract a `iterations x chains x parameters` array of posterior draws with
160160
`as.array`,
@@ -289,7 +289,8 @@ Let's look at how `tau` interacts with other variables, using only one of the
289289
`theta`s to keep the plot readable:
290290

291291
```{r, mcmc_pairs}
292-
mcmc_pairs(posterior_cp, np = np_cp, pars = c("mu","tau","theta[1]"))
292+
mcmc_pairs(posterior_cp, np = np_cp, pars = c("mu","tau","theta[1]"),
293+
off_diag_args = list(size = 0.75))
293294
```
294295

295296
Note that each bivariate plot is present twice -- by default each of those
@@ -325,7 +326,8 @@ scatter_theta_cp <- mcmc_scatter(
325326
posterior_cp,
326327
pars = c("theta[1]", "tau"),
327328
transform = list(tau = "log"), # can abbrev. 'transformations'
328-
np = np_cp
329+
np = np_cp,
330+
size = 1
329331
)
330332
scatter_theta_cp
331333
```
@@ -353,7 +355,8 @@ scatter_eta_ncp <- mcmc_scatter(
353355
posterior_ncp,
354356
pars = c("eta[1]", "tau"),
355357
transform = list(tau = "log"),
356-
np = np_ncp
358+
np = np_ncp,
359+
size = 1
357360
)
358361
scatter_eta_ncp
359362
```
@@ -391,10 +394,11 @@ scatter_theta_ncp <- mcmc_scatter(
391394
posterior_ncp,
392395
pars = c("theta[1]", "tau"),
393396
transform = list(tau = "log"),
394-
np = np_ncp
397+
np = np_ncp,
398+
size = 1
395399
)
396400
397-
compare_cp_ncp(scatter_theta_cp, scatter_theta_ncp, ylim = c(-9, 4))
401+
compare_cp_ncp(scatter_theta_cp, scatter_theta_ncp, ylim = c(-8, 4))
398402
```
399403

400404
Once we transform the `eta` values into `theta` values we actually see an even
@@ -427,11 +431,11 @@ mcmc_trace(posterior_cp, pars = "tau", np = np_cp) +
427431
The first thing to note is that all chains seem to be exploring the same region
428432
of parameter values, which is a good sign. But the plot is too crowded to help
429433
us diagnose divergences. We may however zoom in to investigate, using the
430-
`window` parameter:
434+
`window` argument:
431435

432436
```{r echo=FALSE}
433437
#A check that the chosen window still relevant
434-
n_divergent_in_window <- np_cp %>% filter(Parameter == "divergent__" & Value == 1 & Iteration >= 350 & Iteration <= 500) %>% nrow()
438+
n_divergent_in_window <- np_cp %>% filter(Parameter == "divergent__" & Value == 1 & Iteration >= 50 & Iteration <= 200) %>% nrow()
435439
436440
if(n_divergent_in_window < 6) {
437441
divergences <- np_cp %>% filter(Parameter == "divergent__" & Value == 1) %>% select(Iteration) %>% get("Iteration", .) %>% sort() %>% paste(collapse = ",")
@@ -440,7 +444,7 @@ if(n_divergent_in_window < 6) {
440444
```
441445

442446
```{r, mcmc_trace_zoom}
443-
mcmc_trace(posterior_cp, pars = "tau", np = np_cp, window = c(400,550)) +
447+
mcmc_trace(posterior_cp, pars = "tau", np = np_cp, window = c(50,200)) +
444448
xlab("Post-warmup iteration")
445449
```
446450

@@ -672,7 +676,7 @@ sample size, $n_{eff}$, is usually smaller than the total sample size, $N$
672676
(although it may be larger in some cases[^1]). The larger the ratio of $n_{eff}$ to
673677
$N$ the better (see Gelman et al. 2013, Stan Development Team 2018 for more details) .
674678

675-
[^1]: $n_{eff} > N$` indicates that the mean estimate of the parameter computed from Stan
679+
[^1]: $n_{eff} > N$ indicates that the mean estimate of the parameter computed from Stan
676680
draws approaches the true mean faster than the mean estimate computed from independent
677681
samples from the true posterior
678682
(the estimate from Stan has smaller variance). This is possible when the draws are
@@ -789,8 +793,8 @@ path lengths in Hamiltonian Monte Carlo. *Journal of Machine Learning Research*.
789793
Rubin, D. B. (1981). Estimation in Parallel Randomized Experiments. *Journal of
790794
Educational and Behavioral Statistics*. 6:377--401.
791795

792-
Stan Development Team. (2018). *Stan Modeling Language Users
793-
Guide and Reference Manual*. https://mc-stan.org/users/documentation/
796+
Stan Development Team. _Stan Modeling Language Users
797+
Guide and Reference Manual_. https://mc-stan.org/users/documentation/
794798

795799
Stan Development Team. (2018). RStan: the R interface to Stan. R package version 2.17.3.
796800
https://mc-stan.org/rstan

0 commit comments

Comments
 (0)