Skip to content

Commit

Permalink
lintr, docs
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 20, 2023
1 parent cd7e489 commit f4b3979
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
17 changes: 11 additions & 6 deletions R/describe_posterior.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@
#'
#' if (require("logspline")) {
#' x <- rnorm(1000)
#' describe_posterior(x)
#' describe_posterior(x, centrality = "all", dispersion = TRUE, test = "all")
#' describe_posterior(x, ci = c(0.80, 0.90))
#' describe_posterior(x, verbose = FALSE)
#' describe_posterior(x,
#' centrality = "all",
#' dispersion = TRUE,
#' test = "all",
#' verbose = FALSE
#' )
#' describe_posterior(x, ci = c(0.80, 0.90), verbose = FALSE)
#'
#' df <- data.frame(replicate(4, rnorm(100)))
#' describe_posterior(df, verbose = FALSE)
Expand Down Expand Up @@ -763,7 +768,7 @@ describe_posterior.emmGrid <- function(posteriors,
BF = 1,
...) {
if (any(c("all", "bf", "bayesfactor", "bayes_factor") %in% tolower(test)) ||
"si" %in% tolower(ci_method)) {
"si" %in% tolower(ci_method)) {
samps <- .clean_priors_and_posteriors(posteriors, bf_prior)
bf_prior <- samps$prior
posteriors <- samps$posterior
Expand Down Expand Up @@ -832,7 +837,7 @@ describe_posterior.stanreg <- function(posteriors,
BF = 1,
...) {
if ((any(c("all", "bf", "bayesfactor", "bayes_factor") %in% tolower(test)) ||
"si" %in% tolower(ci_method)) && is.null(bf_prior)) {
"si" %in% tolower(ci_method)) && is.null(bf_prior)) {
bf_prior <- suppressMessages(unupdate(posteriors))
}

Expand Down Expand Up @@ -1030,7 +1035,7 @@ describe_posterior.brmsfit <- function(posteriors,
component <- match.arg(component)

if ((any(c("all", "bf", "bayesfactor", "bayes_factor") %in% tolower(test)) ||
"si" %in% tolower(ci_method)) && is.null(bf_prior)) {
"si" %in% tolower(ci_method)) && is.null(bf_prior)) {
bf_prior <- suppressMessages(unupdate(posteriors))
}

Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ prior <- as.data.frame(density(distribution_normal(10000, mean = 0, sd = 1)))
ggplot(posterior, aes(x = x, y = y)) +
geom_ribbon(aes(ymin = 0, ymax = y), fill = "#FFC107") +
geom_line(data = prior, size = 1, linetype = "dotted") +
geom_line(data = prior, linewidth = 1, linetype = "dotted") +
geom_segment(x = 0, xend = 0, y = 0, yend = max(prior$y), color = "#2196F3", size = 1) +
geom_point(x = 0, y = max(prior$y), color = "#2196F3", size = 5) +
geom_segment(x = 0, xend = 0, y = 0, yend = density_at(posterior$x, 0, bw = "nrd0"), color = "#E91E63", size = 1) +
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ describe_posterior(
)
## Summary of Posterior Distribution
##
## Parameter | Median | 95% CI | pd | ps
## --------------------------------------------------
## Posterior | -0.01 | [-1.96, 1.96] | 50.27% | 0.46
## Parameter | Median | 95% CI | pd | ps
## ----------------------------------------------------
## Posterior | 1.15e-03 | [-2.01, 1.92] | 50.07% | 0.46
```

`describe_posterior()` works for many objects, including more complex
Expand Down
11 changes: 8 additions & 3 deletions man/describe_posterior.Rd

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

0 comments on commit f4b3979

Please sign in to comment.