Skip to content

Commit 0499a91

Browse files
committed
use refresh=0 for stan_glm in examples
1 parent 093c509 commit 0499a91

9 files changed

+11
-10
lines changed

R/bayesplot-extractors.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#' @examples
3737
#' \dontrun{
3838
#' library(rstanarm)
39-
#' fit <- stan_glm(mpg ~ wt, data = mtcars)
39+
#' fit <- stan_glm(mpg ~ wt, data = mtcars, refresh = 0)
4040
#'
4141
#' np <- nuts_params(fit)
4242
#' head(np)

R/bayesplot_grid.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
#' \dontrun{
4343
#' library(rstanarm)
4444
#' mtcars$log_mpg <- log(mtcars$mpg)
45-
#' fit1 <- stan_glm(mpg ~ wt, data = mtcars)
46-
#' fit2 <- stan_glm(log_mpg ~ wt, data = mtcars)
45+
#' fit1 <- stan_glm(mpg ~ wt, data = mtcars, refresh = 0)
46+
#' fit2 <- stan_glm(log_mpg ~ wt, data = mtcars, refresh = 0)
4747
#'
4848
#' y <- mtcars$mpg
4949
#' yrep1 <- posterior_predict(fit1, draws = 50)

R/mcmc-diagnostics-nuts.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
#' \dontrun{
114114
#' library(ggplot2)
115115
#' library(rstanarm)
116-
#' fit <- stan_glm(mpg ~ wt + am, data = mtcars, iter = 1000)
116+
#' fit <- stan_glm(mpg ~ wt + am, data = mtcars, iter = 1000, refresh = 0)
117117
#' np <- nuts_params(fit)
118118
#' lp <- log_posterior(fit)
119119
#'

R/mcmc-diagnostics.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
#'
101101
#' # intentionally use small 'iter' so there are some
102102
#' # problems with rhat and neff for demonstration
103-
#' fit <- stan_glm(mpg ~ ., data = mtcars, iter = 50)
103+
#' fit <- stan_glm(mpg ~ ., data = mtcars, iter = 50, refresh = 0)
104104
#' rhats <- rhat(fit)
105105
#' ratios <- neff_ratio(fit)
106106
#' mcmc_rhat(rhats)

R/mcmc-intervals.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@
131131
#' fit <- stan_glm(
132132
#' mpg ~ 0 + wt + factor(cyl),
133133
#' data = mtcars,
134-
#' iter = 500
134+
#' iter = 500,
135+
#' refresh = 0
135136
#' )
136137
#' x <- as.matrix(fit)
137138
#'

R/mcmc-recover.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#' alpha <- 1; beta <- rnorm(10, 0, 3); sigma <- 2
5959
#' X <- matrix(rnorm(1000), 100, 10)
6060
#' y <- rnorm(100, mean = c(alpha + X %*% beta), sd = sigma)
61-
#' fit <- stan_glm(y ~ ., data = data.frame(y, X))
61+
#' fit <- stan_glm(y ~ ., data = data.frame(y, X), refresh = 0)
6262
#' draws <- as.matrix(fit)
6363
#' print(colnames(draws))
6464
#' true <- c(alpha, beta, sigma)

R/mcmc-scatterplots.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ mcmc_hex <- function(x,
241241
#' # will (almost certainly) have some divergences
242242
#' fit <- stan_glm(
243243
#' mpg ~ ., data = mtcars,
244-
#' iter = 1000,
244+
#' iter = 1000, refresh = 0,
245245
#' # this combo of prior and adapt_delta should lead to some divergences
246246
#' prior = hs(),
247247
#' adapt_delta = 0.9

R/mcmc-traces.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
#'
107107
#' # for models fit using HMC/NUTS divergences can be displayed in the trace plot
108108
#' library("rstanarm")
109-
#' fit <- stan_glm(mpg ~ ., data = mtcars,
109+
#' fit <- stan_glm(mpg ~ ., data = mtcars, refresh = 0,
110110
#' # next line to keep example fast and also ensure we get some divergences
111111
#' prior = hs(), iter = 400, adapt_delta = 0.8)
112112
#'

R/ppc-intervals.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
#'
8282
#' \dontrun{
8383
#' library("rstanarm")
84-
#' fit <- stan_glmer(mpg ~ wt + (1|cyl), data = mtcars)
84+
#' fit <- stan_glmer(mpg ~ wt + (1|cyl), data = mtcars, refresh = 0)
8585
#' yrep <- posterior_predict(fit)
8686
#'
8787
#' color_scheme_set("purple")

0 commit comments

Comments
 (0)