Skip to content

Commit

Permalink
examples
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jul 3, 2023
1 parent 7909153 commit ec7520a
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 26 deletions.
8 changes: 5 additions & 3 deletions R/sexit_thresholds.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
#' sexit_thresholds(rnorm(1000))
#' \dontrun{
#' if (require("rstanarm")) {
#' model <- stan_glm(
#' model <- suppressWarnings(stan_glm(
#' mpg ~ wt + gear,
#' data = mtcars,
#' chains = 2,
#' iter = 200,
#' refresh = 0
#' )
#' ))
#' sexit_thresholds(model)
#'
#' model <- stan_glm(vs ~ mpg, data = mtcars, family = "binomial", refresh = 0)
#' model <- suppressWarnings(
#' stan_glm(vs ~ mpg, data = mtcars, family = "binomial", refresh = 0)
#' )
#' sexit_thresholds(model)
#' }
#'
Expand Down
4 changes: 3 additions & 1 deletion R/simulate_priors.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#' \dontrun{
#' library(bayestestR)
#' if (require("rstanarm")) {
#' model <- stan_glm(mpg ~ wt + am, data = mtcars, chains = 1, refresh = 0)
#' model <- suppressWarnings(
#' stan_glm(mpg ~ wt + am, data = mtcars, chains = 1, refresh = 0)
#' )
#' simulate_prior(model)
#' }
#' }
Expand Down
4 changes: 3 additions & 1 deletion R/spi.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
#' spi(df, ci = c(0.80, 0.89, 0.95))
#' \dontrun{
#' library(rstanarm)
#' model <- stan_glm(mpg ~ wt + gear, data = mtcars, chains = 2, iter = 200, refresh = 0)
#' model <- suppressWarnings(
#' stan_glm(mpg ~ wt + gear, data = mtcars, chains = 2, iter = 200, refresh = 0)
#' )
#' spi(model)
#' }
#'
Expand Down
16 changes: 8 additions & 8 deletions R/weighted_posteriors.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@
#' @examples
#' \donttest{
#' if (require("rstanarm") && require("see")) {
#' stan_m0 <- stan_glm(extra ~ 1,
#' stan_m0 <- suppressWarnings(stan_glm(extra ~ 1,
#' data = sleep,
#' family = gaussian(),
#' refresh = 0,
#' diagnostic_file = file.path(tempdir(), "df0.csv")
#' )
#' ))
#'
#' stan_m1 <- stan_glm(extra ~ group,
#' stan_m1 <- suppressWarnings(stan_glm(extra ~ group,
#' data = sleep,
#' family = gaussian(),
#' refresh = 0,
#' diagnostic_file = file.path(tempdir(), "df1.csv")
#' )
#' ))
#'
#' res <- weighted_posteriors(stan_m0, stan_m1)
#'
Expand All @@ -73,21 +73,21 @@
#'
#' ## weighted prediction distributions via data.frames
#' if (require("rstanarm")) {
#' m0 <- stan_glm(
#' m0 <- suppressWarnings(stan_glm(
#' mpg ~ 1,
#' data = mtcars,
#' family = gaussian(),
#' diagnostic_file = file.path(tempdir(), "df0.csv"),
#' refresh = 0
#' )
#' ))
#'
#' m1 <- stan_glm(
#' m1 <- suppressWarnings(stan_glm(
#' mpg ~ carb,
#' data = mtcars,
#' family = gaussian(),
#' diagnostic_file = file.path(tempdir(), "df1.csv"),
#' refresh = 0
#' )
#' ))
#'
#' # Predictions:
#' pred_m0 <- data.frame(posterior_predict(m0))
Expand Down
8 changes: 5 additions & 3 deletions man/sexit_thresholds.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/simulate_prior.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/spi.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions man/weighted_posteriors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ec7520a

Please sign in to comment.