Skip to content

Commit 26458ac

Browse files
committed
large-data.Rmd: move library calls to top of vignette
1 parent 70edb3f commit 26458ac

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

vignettes/large-data.Rmd

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ Proceedings of the 23rd International Conference on Artificial Intelligence and
3737
which provide important background for understanding the methods implemented in
3838
the 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.
96106
Next 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
103110
url <- "http://stat.columbia.edu/~gelman/arm/examples/arsenic/wells.dat"
104111
wells <- read.table(url)
@@ -144,7 +151,6 @@ We can then use the `loo_subsample()` function to compute the efficient PSIS-LOO
144151
approximation to exact LOO-CV using subsampling:
145152

146153
```{r, eval=FALSE}
147-
library("loo")
148154
parameter_draws_1 <- extract(fit_1)$beta
149155
stan_df_1 <- as.data.frame(standata)
150156

0 commit comments

Comments
 (0)