Description Format See Also Examples

A model for use in rstanarm examples.

Calling `example("example_model")`

will run the model in the
Examples section, below, and the resulting stanreg object will then be
available in the global environment. The `chains`

and `iter`

arguments are specified to make this example be small in size. In practice,
we recommend that they be left unspecified in order to use the default
values (4 and 2000 respectively) or increased if there are convergence
problems. The `cores`

argument is optional and on a multicore system,
the user may well want to set that equal to the number of chains being
executed.

`cbpp`

for a description of the data.

1 2 3 4 5 6 | ```
example_model <-
stan_glmer(cbind(incidence, size - incidence) ~ size + period + (1|herd),
data = lme4::cbpp, family = binomial, QR = TRUE,
# this next line is only to keep the example small in size!
chains = 2, cores = 1, seed = 12345, iter = 500, refresh = 0)
example_model
``` |

```
Loading required package: Rcpp
rstanarm (Version 2.15.3, packaged: 2017-04-29 06:18:44 UTC)
- Do not expect the default priors to remain the same in future rstanarm versions.
Thus, R scripts should specify priors explicitly, even if they are just the defaults.
- For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores())
trying deprecated constructor; please alert package maintainer
Gradient evaluation took 0.000107 seconds
1000 transitions using 10 leapfrog steps per transition would take 1.07 seconds.
Adjust your expectations accordingly!
Elapsed Time: 0.485015 seconds (Warm-up)
0.198294 seconds (Sampling)
0.683309 seconds (Total)
Gradient evaluation took 3.9e-05 seconds
1000 transitions using 10 leapfrog steps per transition would take 0.39 seconds.
Adjust your expectations accordingly!
Elapsed Time: 0.547961 seconds (Warm-up)
0.227128 seconds (Sampling)
0.775089 seconds (Total)
stan_glmer
family: binomial [logit]
formula: cbind(incidence, size - incidence) ~ size + period + (1 | herd)
------
Estimates:
Median MAD_SD
(Intercept) -1.6 0.6
size 0.0 0.0
period2 -1.0 0.3
period3 -1.1 0.3
period4 -1.6 0.4
Error terms:
Groups Name Std.Dev.
herd (Intercept) 0.78
Num. levels: herd 15
Sample avg. posterior predictive
distribution of y (X = xbar):
Median MAD_SD
mean_PPD 1.8 0.2
------
For info on the priors used see help('prior_summary.stanreg').
```

rstanarm documentation built on Oct. 4, 2019, 1:04 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.