@@ -56,7 +56,7 @@ regression model as in the case study.
5656Here is the Stan code for fitting the Poisson regression model, which
5757we will use for modelling the number of roaches.
5858
59- ``` {r, stancode}
59+ ``` {r stancode}
6060stancode <- "
6161data {
6262 int<lower=1> K;
@@ -96,7 +96,7 @@ we compute the log-likelihood for each observation in the
9696In addition to __ loo__ , we load the __ rstan__ package for fitting the model,
9797and the __ rstanarm__ package for the data.
9898
99- ``` {r, setup, message=FALSE}
99+ ``` {r setup, message=FALSE}
100100library("rstan")
101101library("loo")
102102seed <- 9547
@@ -107,7 +107,7 @@ set.seed(seed)
107107
108108Next we fit the model in Stan using the __ rstan__ package:
109109
110- ``` {r, modelfit}
110+ ``` {r modelfit, message=FALSE }
111111# Prepare data
112112data(roaches, package = "rstanarm")
113113roaches$roach1 <- sqrt(roaches$roach1)
@@ -129,7 +129,7 @@ print(fit, pars = "beta")
129129
130130Let us now evaluate the predictive performance of the model using ` loo() ` .
131131
132- ``` {r, loo1}
132+ ``` {r loo1}
133133loo1 <- loo(fit)
134134loo1
135135```
@@ -220,7 +220,7 @@ Next, we show how the helper functions look like for RStan objects, and show an
220220example of using ` loo_moment_match() ` directly. For stanfit objects from
221221__ rstan__ objects, the functions look like this:
222222
223- ``` {r, stanfitfuns}
223+ ``` {r stanfitfuns}
224224# create a named list of draws for use with rstan methods
225225.rstan_relist <- function(x, skeleton) {
226226 out <- utils::relist(x, skeleton)
@@ -306,9 +306,7 @@ As expected, the result is identical to the previous result of
306306
307307Gelman, A., and Hill, J. (2007). * Data Analysis Using Regression and Multilevel Hierarchical Models.* Cambridge University Press.
308308
309- Stan Development Team (2017). _ The Stan C++ Library, Version 2.17.0._ http://mc-stan.org
310-
311- Stan Development Team (2018) _ RStan: the R interface to Stan, Version 2.17.3._ http://mc-stan.org
309+ Stan Development Team (2020) _ RStan: the R interface to Stan, Version 2.21.1_ https://mc-stan.org
312310
313311Paananen, T., Piironen, J., Buerkner, P.-C., Vehtari, A. (2020).
314312Implicitly Adaptive Importance Sampling.
0 commit comments