File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ Proceedings of the 23rd International Conference on Artificial Intelligence and
3737which provide important background for understanding the methods implemented in
3838the package.
3939
40+ # Setup
41+
42+ In addition to the __ loo__ package, we'll also be using __ rstan__ :
43+
44+ ``` {r setup, message=FALSE}
45+ library("rstan")
46+ library("loo")
47+ set.seed(4711)
48+ ```
49+
4050
4151# Example: Well water in Bangladesh
4252
@@ -96,9 +106,6 @@ Below we will test that the function is working by using the `loo_i()` function.
96106Next we fit the model in Stan using the ** rstan** package:
97107
98108``` {r, eval=FALSE}
99- library("rstan")
100- set.seed(4711)
101-
102109# Prepare data
103110url <- "http://stat.columbia.edu/~gelman/arm/examples/arsenic/wells.dat"
104111wells <- read.table(url)
@@ -144,7 +151,6 @@ We can then use the `loo_subsample()` function to compute the efficient PSIS-LOO
144151approximation to exact LOO-CV using subsampling:
145152
146153``` {r, eval=FALSE}
147- library("loo")
148154parameter_draws_1 <- extract(fit_1)$beta
149155stan_df_1 <- as.data.frame(standata)
150156
You can’t perform that action at this time.
0 commit comments