profile
viewpoint
TJ Mahr tjmahr Madison, WI tjmahr.com Language and data scientist

pull request commentstan-dev/bayesplot

Feature tidyselect

I was worried about mixed models where you get a lot going on the brackets, so I tried to make a general one. This would require glue, but glue is dependency-less and it is required by most of the tidyverse packages that we already depend on.

library(tidyverse)
#> Registered S3 methods overwritten by 'ggplot2':
#>   method         from 
#>   [.quosures     rlang
#>   c.quosures     rlang
#>   print.quosures rlang
d <- structure(list(b_Intercept = c(0.25, 0.13, 0.77, 0.67, 0.44, 
0.33), sd_condition__Intercept = c(1.01, 1.01, 0.78, 0.77, 0.89, 
0.76), sigma = c(0.63, 0.54, 0.62, 0.59, 0.47, 0.44), `r_condition[A,Intercept]` = c(-0.2, 
0.16, -0.82, -0.28, -0.53, -0.25), `r_condition[B,Intercept]` = c(0.98, 
0.53, 0.44, 0.15, 0.74, 0.41), `r_condition[C,Intercept]` = c(1.33, 
1.79, 0.83, 1.5, 1.15, 1.54), `r_condition[A,Slope]` = c(0.86, 
0.78, 0.19, -0.14, 0.87, 0.49), `r_condition[B,Slope]` = c(-1.18, 
-0.96, -1.66, -1.62, -1.53, -1.1), lp__ = c(-51.66, -51.15, -53.32, 
-56.79, -56.48, -54.96)), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -6L))
  
param_glue <- function(pattern, ...) {
  dots <- as.list(expand.grid(...))
  nms <- as.character(glue::glue_data(dots, pattern))

  param_matches <- match(nms, tidyselect::peek_vars())
  param_matches[!is.na(param_matches)]
}

d
#> # A tibble: 6 x 9
#>   b_Intercept sd_condition__I~ sigma `r_condition[A,~ `r_condition[B,~
#>         <dbl>            <dbl> <dbl>            <dbl>            <dbl>
#> 1        0.25             1.01  0.63            -0.2              0.98
#> 2        0.13             1.01  0.54             0.16             0.53
#> 3        0.77             0.78  0.62            -0.82             0.44
#> 4        0.67             0.77  0.59            -0.28             0.15
#> 5        0.44             0.89  0.47            -0.53             0.74
#> 6        0.33             0.76  0.44            -0.25             0.41
#> # ... with 4 more variables: `r_condition[C,Intercept]` <dbl>,
#> #   `r_condition[A,Slope]` <dbl>, `r_condition[B,Slope]` <dbl>, lp__ <dbl>

d %>% 
  select(
    param_glue(
      "r_condition[{level},Intercept]", 
      level = c("A", "B"))
  )
#> # A tibble: 6 x 2
#>   `r_condition[A,Intercept]` `r_condition[B,Intercept]`
#>                        <dbl>                      <dbl>
#> 1                      -0.2                        0.98
#> 2                       0.16                       0.53
#> 3                      -0.82                       0.44
#> 4                      -0.28                       0.15
#> 5                      -0.53                       0.74
#> 6                      -0.25                       0.41

d %>% 
  select(
    param_glue(
      "r_condition[{level},{type}]", 
      level = c("A", "B"), 
      type = c("Intercept", "Slope"))
    )
#> # A tibble: 6 x 4
#>   `r_condition[A,In~ `r_condition[B,In~ `r_condition[A,S~ `r_condition[B,S~
#>                <dbl>              <dbl>             <dbl>             <dbl>
#> 1              -0.2                0.98              0.86             -1.18
#> 2               0.16               0.53              0.78             -0.96
#> 3              -0.82               0.44              0.19             -1.66
#> 4              -0.28               0.15             -0.14             -1.62
#> 5              -0.53               0.74              0.87             -1.53
#> 6              -0.25               0.41              0.49             -1.1

<sup>Created on 2019-05-20 by the reprex package (v0.3.0)</sup>

jgabry

comment created time in 12 hours

pull request commentstan-dev/bayesplot

Add sbc_hist

Aah shoot, that last figure has 33 bins because of how 129 was being rounded.

General problem still stands.

jpritikin

comment created time in 15 hours

pull request commentstan-dev/bayesplot

Add sbc_hist

What's the point of the butterfly shape, as opposed to a ribbon?

I don't think the bin boundaries are working correctly. First one straddles 0 and last one do not appear to evenly line up with 128, at least on my device. Histograms work on continuous data, so they don't respect the discrete boundaries of the rankings by default.

The use of the ribbon expands the x-axis so that the nonsensical values are part of the binning, so I think we are getting 128 ranks pushed into 29 bins which is causing uneven binning.

sbc_hist(ranks) + 
  geom_text(aes(label = stat(count)), stat = "bin", bins = 32)

image

This is probably a better sense of what 32 bins should be...

sbc_hist(ranks) + 
  stat_count(aes(x = plyr::round_any(u, 4, floor)))

image

jpritikin

comment created time in 15 hours

pull request commentstan-dev/bayesplot

Feature tidyselect

num_range() doesn't work if the parameters have brackets in their names like "beta[1]", "beta[2]", ..., "beta[10]", which is far more common. But we could conceivably export a helper function like this:

This is great.

jgabry

comment created time in 16 hours

issue commentstan-dev/bayesplot

Facilitating DAGs

greta does something like this. https://greta-stats.org/articles/get_started.html#plotting

image

But I don't know how its DAG building is implemented, but the plotting uses DiagrammeR. I've used to DiagrammeR convert lavaan SEM models into graphs. DiagrammeR builds graphs from dataframes, so the main task would be to have a language that describe interrelations among model parameters and then use that build a dataframe for plotting.

bgoodri

comment created time in 4 days

startedj2kun/rote

started time in 4 days

startedlionel-/flowery

started time in 4 days

startedrwinlib/base

started time in 4 days

Pull request review commentstan-dev/bayesplot

Use markdown in roxygen

 % Please edit documentation in R/bayesplot-ggplot-themes.R \name{theme_default} \alias{theme_default}-\title{Default bayesplot plotting theme}+\title{Default \strong{bayesplot} plotting theme} \usage{ theme_default(base_size = getOption("bayesplot.base_size", 12),   base_family = getOption("bayesplot.base_family", "serif")) } \arguments{ \item{base_size, base_family}{Base font size and family (passed to-\code{\link[ggplot2]{theme_bw}}). It is possible to set-\code{"bayesplot.base_size"} and \code{"bayesplot.base_family"} via-\code{\link{options}} to change the defaults, which are \code{12} and-\code{"serif"}, respectively.}+\code{\link[ggplot2:theme_bw]{ggplot2::theme_bw()}}). It is possible to set \code{"bayesplot.base_size"} and+\code{"bayesplot.base_family"} via \code{\link[=options]{options()}} to change the defaults, w

i fixed it

jgabry

comment created time in 4 days

push eventstan-dev/bayesplot

TJ Mahr

commit sha 4a94f368e10361ce4463f35b94e98e205a82d76b

fix typos

view details

push time in 4 days

Pull request review commentstan-dev/bayesplot

Use markdown in roxygen

 \name{bayesplot-package} \alias{bayesplot-package} \alias{bayesplot}-\title{Plots for Bayesian Models}+\title{\strong{bayesplot}: Plotting for Bayesian Models} \description{ \if{html}{    \figure{stanlogo.png}{options: width="50px" alt="mc-stan.org"}-   \emph{Stan Development Team} }+\emph{Stan Development Team} -The \pkg{bayesplot} package provides a variety of \pkg{ggplot2}-based+The \strong{bayesplot} package provides a variety of \strong{ggplot2}-based plotting functions for use after fitting Bayesian models (typically, though not exclusively, via Markov chain Monte Carlo). The package is designed not only to provide convenient functionality for users, but also a common set of functions that can be easily used by developers working on a variety of packages for Bayesian modeling, particularly (but not necessarily) packages-powered by \pkg{\link[rstan]{rstan}}. Examples of packages that will soon (or-already are) using \pkg{bayesplot} are \pkg{rstan} itself, as well as the-\pkg{rstan}-dependent \pkg{rstanarm} and \pkg{brms} packages for applied-regression modeling.+powered by \link[rstan:rstan-package]{rstan} (the \R interface to Stan).+Examples of packages that will soon (or already are) using \strong{bayesplot} are+\strong{rstan} itself, as well as the \strong{rstan}-dependent \strong{rstanarm} and+\strong{brms} packages for applied regression modeling. }

This is just an observation... I'm noticing that all the \pkg tags turn into \strong codes. I guess that will cause them to turn bold on the pkgdown site too, which is fine.

jgabry

comment created time in 4 days

Pull request review commentstan-dev/bayesplot

Use markdown in roxygen

 % Please edit documentation in R/bayesplot-ggplot-themes.R \name{theme_default} \alias{theme_default}-\title{Default bayesplot plotting theme}+\title{Default \strong{bayesplot} plotting theme} \usage{ theme_default(base_size = getOption("bayesplot.base_size", 12),   base_family = getOption("bayesplot.base_family", "serif")) } \arguments{ \item{base_size, base_family}{Base font size and family (passed to-\code{\link[ggplot2]{theme_bw}}). It is possible to set-\code{"bayesplot.base_size"} and \code{"bayesplot.base_family"} via-\code{\link{options}} to change the defaults, which are \code{12} and-\code{"serif"}, respectively.}+\code{\link[ggplot2:theme_bw]{ggplot2::theme_bw()}}). It is possible to set \code{"bayesplot.base_size"} and+\code{"bayesplot.base_family"} via \code{\link[=options]{options()}} to change the defaults, w

which split across lines

jgabry

comment created time in 4 days

startedmdequeljoe/rdoc

started time in 5 days

startedJohnCoene/g2r

started time in 5 days

startedricharddmorey/divergingPips

started time in 5 days

pull request commentstan-dev/bayesplot

Add ColorBrewer palettes

Take a look at my changes and feel free to merge.

jgabry

comment created time in 6 days

push eventstan-dev/bayesplot

TJ Mahr

commit sha 50f9798feb3ce40ed19904b7ef70f5d48d798ef4

include link to colorbrewer

view details

TJ Mahr

commit sha acfd44a21dc6578a04e92bf13416f1183c1b5e6b

- add braces around if-elses - use `is.null()` and `NULL` default instead of `missing()` to make interactive testing easier - refactor full_level_name to use a look-up table and get vectorization for free

view details

push time in 6 days

Pull request review commentstan-dev/bayesplot

Add ColorBrewer palettes

 get_color <- function(levels) {   color_vals <- color_scheme_get()[levels]   unlist(color_vals, use.names = FALSE) }+ full_level_name <- function(x) {

I'm adding a commit where I refactor this to not use a switch() but use the named-vector look-up table trick to get vectorization for free. adv-r.had.co.nz/Subsetting.html#lookup-tables

jgabry

comment created time in 6 days

Pull request review commentstan-dev/bayesplot

Add ColorBrewer palettes

 is_hex_color <- function(x) {   isTRUE(nchar(x) == 7)

ggplot2 will take nine character ones where the last two set the alpha level. Some palettes emit colors with these extra characters.

scales::viridis_pal()(4)
#> [1] "#440154FF" "#31688EFF" "#35B779FF" "#FDE725FF"

Not sure we need to accommodate this though.

jgabry

comment created time in 6 days

startedalexpghayes/distributions

started time in 7 days

startedkaz-yos/bayes2018

started time in 7 days

push eventstan-dev/bayesplot

TJ Mahr

commit sha c7230429562a720960d41bf9a912c196f78eff2e

repair merge

view details

TJ Mahr

commit sha 8ffa499934a644620a1dd7a8820dcb86a70d24a8

export mcmc_trace_data()

view details

push time in 11 days

push eventstan-dev/bayesplot

jgabry

commit sha 918e0dee23218285dbf4950cc258c813fa89c104

allow negative integer input to ppc_bars, ppc_bars_grouped closes #172

view details

jgabry

commit sha a21f48ba493e271a54582a7b7e80f92f18ffece8

Update NEWS.md

view details

Jonah Gabry

commit sha 63e02bfb4beaffb93f732aa7664efff442729452

Update doc in ppc-discrete.R [ci skip]

view details

TJ Mahr

commit sha fd4219a27c178fe3714e542f03e863110e327ab5

fix indentation

view details

jgabry

commit sha 3476f655db28fd7964dc09316611deaa1d305c9e

fix test-extractors

view details

Jonah Gabry

commit sha c3c841f13998cda0754aff4f90ef082149bd8df2

Merge pull request #173 from stan-dev/bugfix-issue-172 allow negative integer input to ppc_bars, ppc_bars_grouped

view details

jgabry

commit sha ea1ca2740dd429a5328f8deb7d0f5faf987bb737

minor cleaning [ci skip]

view details

jgabry

commit sha b9bbc4f8abcf4e2b33b987a9c3eecaec687bf9f4

rewrite arm's binned error function

view details

jgabry

commit sha 9177de0fbebd1c231f034ce4c1051eda196aeb3f

remove arm from DESCRIPTION [ci skip]

view details

jgabry

commit sha 67ba2e84bb560299f3c3c235b08138d11c3ad4be

remove suggested_package("arm") [ci skip]

view details

jgabry

commit sha 267c53207c2925b6464708223a8c5a147b18fcd6

binned_error_data internal

view details

jgabry

commit sha a1b0233f4dc8d7e7f350d5e26825e33fe49faa2c

check rows of errors instead of yrep (doesn't really matter)

view details

jgabry

commit sha 707eed82b144e654465e4b47764a83eae445a381

add bins argument [ci skip]

view details

jgabry

commit sha 10aa75d490f0186ce8a0b8163e3a20574f150567

Call as.array on input to prepare_mcmc_array

view details

jgabry

commit sha 22b0d70143a527028a8e31cd3c0971df333d2859

update args-mcmc-x roxygen template

view details

jgabry

commit sha 9028173fb8637620ea682d73987d4b3bdaa6b0be

add one more line to tests

view details

jgabry

commit sha 9eaa56ba9763de555c41e11301c78c4627c31044

Update NEWS.md [ci skip]

view details

Jonah Gabry

commit sha dbd7135c67ce86423d4582ed9d4e937995c30dae

Update README.md [ci skip]

view details

Jonah Gabry

commit sha 6c3ea0423418763c9d482791cda074ec08f01973

Update README.md [ci skip]

view details

TJ Mahr

commit sha bfe5c662e7676b617e7ce16b879f78b613213bac

Merge pull request #184 from stan-dev/coerce-to-array Call as.array on input to prepare_mcmc_array()

view details

push time in 11 days

push eventstan-dev/bayesplot

TJ Mahr

commit sha 3955ec5f3e29b42dd1e916176442cceed7324f60

Use standard evaluation

view details

push time in 11 days

pull request commentstan-dev/bayesplot

[WIP] Rank histogram

Do I read the pull request correctly that it doesn't yet have a function which would plot the rank histograms in different subplots? (I don't like the overlaid histograms as they get easily messy). -- @ave

I've added mcmc_rank_hist().

library(bayesplot)
#> Registered S3 methods overwritten by 'ggplot2':
#>   method         from 
#>   [.quosures     rlang
#>   c.quosures     rlang
#>   print.quosures rlang
#> This is bayesplot version 1.6.0.9000
#> - Online documentation and vignettes at mc-stan.org/bayesplot
#> - bayesplot theme set to bayesplot::theme_default()
#>    * Does _not_ affect other ggplot2 plots
#>    * See ?bayesplot_theme_set for details on theme setting
x <- example_mcmc_draws()
color_scheme_set("viridisE")
mcmc_rank_hist(x, c("beta[1]"))

mcmc_rank_hist(x, c("alpha", "beta[1]"))

<sup>Created on 2019-05-10 by the reprex package (v0.2.1)</sup>

tjmahr

comment created time in 11 days

push eventstan-dev/bayesplot

TJ Mahr

commit sha 0f357690f9f35690115b65a6b4ae773f00be0e2b

fix description

view details

TJ Mahr

commit sha e2a888a434753d1a776e18f5fec2306aebeef410

add mcmc_rank_hist()

view details

push time in 11 days

startedjhelvy/stanTuner

started time in 12 days

push eventtjmahr/scam

TJ Mahr

commit sha 9342f7c75257b50dc76b06f0e81a6ee31b8ef8df

Update uni.smooth.const-with-po.r

view details

push time in 12 days

fork tjmahr/scam

:exclamation: This is a read-only mirror of the CRAN R package repository. scam — Shape Constrained Additive Models

fork in 12 days

startedLudvigOlsen/groupdata2

started time in 12 days

startedLudvigOlsen/cvms

started time in 12 days

startedsingmann/mixed_model_workshop_2day

started time in 15 days

startedisocpp/CppCoreGuidelines

started time in 15 days

CommitCommentEvent

push eventstan-dev/bayesplot

TJ Mahr

commit sha 9b0ed3964a357f6b7bab67b24466a479d67229ec

Fix check error. Without setting `diag_fun` to a vector of length 1, this line of code causes a warning later on: `diag_fun == "hist" && use_default_binwidth`. This warning raises an error during rcmdcheck::rcmdcheck()

view details

push time in 18 days

delete branch stan-dev/bayesplot

delete branch : remove-arm-dependency

delete time in 18 days

push eventstan-dev/bayesplot

jgabry

commit sha b9bbc4f8abcf4e2b33b987a9c3eecaec687bf9f4

rewrite arm's binned error function

view details

jgabry

commit sha 9177de0fbebd1c231f034ce4c1051eda196aeb3f

remove arm from DESCRIPTION [ci skip]

view details

jgabry

commit sha 67ba2e84bb560299f3c3c235b08138d11c3ad4be

remove suggested_package("arm") [ci skip]

view details

jgabry

commit sha 267c53207c2925b6464708223a8c5a147b18fcd6

binned_error_data internal

view details

jgabry

commit sha a1b0233f4dc8d7e7f350d5e26825e33fe49faa2c

check rows of errors instead of yrep (doesn't really matter)

view details

jgabry

commit sha 707eed82b144e654465e4b47764a83eae445a381

add bins argument [ci skip]

view details

TJ Mahr

commit sha bd6d26d786ddb11ce03c9f969b5930a33b512764

Merge branch 'master' into remove-arm-dependency

view details

TJ Mahr

commit sha 691cfea18fdffdcc7cf4ca1ce3c31e744b86df34

Merge pull request #182 from stan-dev/remove-arm-dependency Remove 'arm' dependency

view details

push time in 18 days

PR merged stan-dev/bayesplot

Remove 'arm' dependency

This PR removes the dependency on the 'arm' package, which was only being used internally for ppc_error_binned(). bayesplot now does the binning itself before plotting.

+80 -46

0 comment

3 changed files

jgabry

pr closed time in 18 days

push eventstan-dev/bayesplot

jgabry

commit sha 10aa75d490f0186ce8a0b8163e3a20574f150567

Call as.array on input to prepare_mcmc_array

view details

jgabry

commit sha 22b0d70143a527028a8e31cd3c0971df333d2859

update args-mcmc-x roxygen template

view details

jgabry

commit sha 9028173fb8637620ea682d73987d4b3bdaa6b0be

add one more line to tests

view details

jgabry

commit sha 9eaa56ba9763de555c41e11301c78c4627c31044

Update NEWS.md [ci skip]

view details

Jonah Gabry

commit sha dbd7135c67ce86423d4582ed9d4e937995c30dae

Update README.md [ci skip]

view details

Jonah Gabry

commit sha 6c3ea0423418763c9d482791cda074ec08f01973

Update README.md [ci skip]

view details

TJ Mahr

commit sha bfe5c662e7676b617e7ce16b879f78b613213bac

Merge pull request #184 from stan-dev/coerce-to-array Call as.array on input to prepare_mcmc_array()

view details

TJ Mahr

commit sha 8d3e57f47582c47067d921079f548e8b84ee2bab

add visual unit test for ppc_error_binned() to assess #182

view details

TJ Mahr

commit sha 848cafd1e4b501af8954ef417c49ce19d21a15ca

changes to fix deprecation warnings

view details

TJ Mahr

commit sha bc531fa79169beca52112f0356150a3ad9699872

Require hexbin ggplot2 doesn't provide it by default so on a fresh install, mcmc_hex() doesn't work.

view details

TJ Mahr

commit sha b27d9b72b7c1f9e42a1b871c9951aba5545b749e

fix ppc_violion_grouped() visual tests. closes #185.

view details

TJ Mahr

commit sha bd6d26d786ddb11ce03c9f969b5930a33b512764

Merge branch 'master' into remove-arm-dependency

view details

push time in 18 days

issue commentstan-dev/bayesplot

infer annotation aesthetics from global theme

Let's wait and see what happens here https://github.com/tidyverse/ggplot2/pull/2749 where the ggplot2 authors are sorting out how to make default aesthetics customizable with a plotting theme.

tjmahr

comment created time in 18 days

issue commentstan-dev/bayesplot

Add colorblind safe and printer friendly options to color_scheme_set

We do provide the four viridis palettes, plus the fifth cividis palette has been added in a different branch. But maybe it could be easier to switch to Brewer palettes.

VeenDuco

comment created time in 18 days

issue closedstan-dev/bayesplot

update unit tests after ggplot2 release

The change in ggplot2 to use tidy evaluation means quosures are used inside of ggplot2. Thus, this class of unit tests...

g <- mcmc_intervals(arr, rhat = r)
rhat_map <- g$layers[[3]][["mapping"]]
expect_identical(rhat_map$colour, as.name("rhat_rating"))
#> Error: rhat_map$colour not identical to as.name("rhat_rating").
#> target, current differ in having response: FALSE, FALSE

will fail because the former is a quosure and the latter is a name.

rhat_map$colour
#> <quosure>
#>   expr: ^rhat_rating
#>   env:  000000001DE45EF8
as.name("rhat_rating")
#> rhat_rating

But as far as I can tell, we can get the name with

rlang::get_expr(rhat_map$colour)
expect_identical(rlang::get_expr(rhat_map$colour), as.name("rhat_rating"))

Here are the first batch of errors...

test-mcmc-intervals.R:89: failure: mcmc_intervals/areas with rhat
rhat_map$colour not identical to as.name("rhat_rating").
target, current differ in having response: FALSE, FALSE

test-mcmc-intervals.R:98: failure: mcmc_intervals/areas with rhat
rhat_map2$fill not identical to as.name("rhat_rating").
target, current differ in having response: FALSE, FALSE

test-mcmc-intervals.R:99: failure: mcmc_intervals/areas with rhat
rhat_map2$colour not identical to as.name("rhat_rating").
target, current differ in having response: FALSE, FALSE

test-mcmc-intervals.R:105: failure: mcmc_intervals/areas with rhat
rhat_map4$colour not identical to as.name("rhat_rating").
target, current differ in having response: FALSE, FALSE

test-mcmc-intervals.R:109: failure: mcmc_intervals/areas with rhat
rhat_map5$colour not identical to as.name("rhat_rating").
target, current differ in having response: FALSE, FALSE

== Terminating early =================================================
Too many failures

closed time in 18 days

tjmahr

issue commentstan-dev/bayesplot

update unit tests after ggplot2 release

The failing tests described above here have been fixed.

tjmahr

comment created time in 18 days

CommitCommentEvent

push eventstan-dev/bayesplot

TJ Mahr

commit sha 8d3e57f47582c47067d921079f548e8b84ee2bab

add visual unit test for ppc_error_binned() to assess #182

view details

TJ Mahr

commit sha 848cafd1e4b501af8954ef417c49ce19d21a15ca

changes to fix deprecation warnings

view details

TJ Mahr

commit sha bc531fa79169beca52112f0356150a3ad9699872

Require hexbin ggplot2 doesn't provide it by default so on a fresh install, mcmc_hex() doesn't work.

view details

TJ Mahr

commit sha b27d9b72b7c1f9e42a1b871c9951aba5545b749e

fix ppc_violion_grouped() visual tests. closes #185.

view details

push time in 19 days

issue closedstan-dev/bayesplot

accommodate R 3.6.0 changes to sample() in unit tests

The visual unit test for ppc_violin_grouped() fails on the new version of R (3.6.0). The jittering of the points is different because a bug was fixed in R's sample() function.

  • [x] update the reference plots to reflect R 3.6.0
  • [x] use testthat::skip_if() to skip the test on versions of R before 3.6.0

I'm making this problem an issue to document what's going on if we run into testing problems with jittered or sample()-ed data.

closed time in 19 days

tjmahr

issue openedstan-dev/bayesplot

random warning on unit test

Sometimes I get the following warning when running tests

test-ppc-test-statistics.R:30: warning: ppc_stat returns ggplot object
Computation failed in `stat_bin()`:
`binwidth` must be positive

The specific test is

  expect_gg(ppc_stat(y2, yrep2, stat = "prop0"))

But this doesn't happen every time. We need to bin down this nondeterminism.

created time in 19 days

issue openedstan-dev/bayesplot

accommodate R 3.6.0 changes to sample() in unit tests

The visual unit test for ppc_violin_grouped() fails on the new version of R (3.6.0). The jittering of the points is different because a bug was fixed in the R's sample() function.

  • [ ] update the reference plots to reflect R 3.6.0
  • [ ] use testthat::skip_if() to skip the test on versions of R before 3.6.0

I'm making this an issue to document what's going on if we run into testing problems with jittered or sample()-ed data.

created time in 19 days

delete branch stan-dev/bayesplot

delete branch : coerce-to-array

delete time in 19 days

push eventstan-dev/bayesplot

jgabry

commit sha 10aa75d490f0186ce8a0b8163e3a20574f150567

Call as.array on input to prepare_mcmc_array

view details

jgabry

commit sha 22b0d70143a527028a8e31cd3c0971df333d2859

update args-mcmc-x roxygen template

view details

jgabry

commit sha 9028173fb8637620ea682d73987d4b3bdaa6b0be

add one more line to tests

view details

jgabry

commit sha 9eaa56ba9763de555c41e11301c78c4627c31044

Update NEWS.md [ci skip]

view details

TJ Mahr

commit sha bfe5c662e7676b617e7ce16b879f78b613213bac

Merge pull request #184 from stan-dev/coerce-to-array Call as.array on input to prepare_mcmc_array()

view details

push time in 19 days

PR merged stan-dev/bayesplot

Call as.array on input to prepare_mcmc_array() feature

Closes #175.

As suggested by @bgoodri, with this PR objects with as.array methods can now be passed to the MCMC plots (not the PPC plots) without the user having to call as.array. For example,

fit <- stan_glm(mpg ~ wt, data = mtcars)

# these give the same result now
mcmc_hist(fit)
mcmc_hist(as.array(fit))

If the resulting array doesn't have 2 or 3 dimensions an error is thrown.

+98 -74

1 comment

15 changed files

jgabry

pr closed time in 19 days

issue closedstan-dev/bayesplot

Always call `as.matrix` or `as.array` on the first argument

If I have a stanreg object called post, then

bayesplot::mcmc_acf(post)

should just work, but it doesn't because the first argument is neither a matrix nor an array. But when no specific method is defined for stanreg objects, the bayesplot functions should just call as.matrix or as.array on the first argument internally, like apply and things like that do. That way we can accept anything that can be coerced into a matrix or an array without having to write methods for everything.

closed time in 19 days

bgoodri

startedAliciaSchep/gglabeller

started time in 20 days

startedcrsh/rmdfiltr

started time in 21 days

startedbob-carpenter/case-studies

started time in 22 days

startedbootphon/phonemizer

started time in 22 days

starteddmort27/epitran

started time in 22 days

startedtgerke/nih-rmd-template

started time in 22 days

startedeasystats/correlation

started time in 22 days

startedGoldbergData/no-api-no-problem

started time in 22 days

startedDataScienceMaterials/SoMN_StatChat_2019

started time in 22 days

startedyonicd/bplyr

started time in 22 days

startedchasemc/electricShine

started time in 22 days

startedcoolbutuseless/ggreverse

started time in 22 days

startedrensa/stickylabeller

started time in 22 days

push eventtjmahr/bayesplot-satrdays-2019

TJ Mahr

commit sha 745e40040801e36b84f193dec99db20bc1577042

try index.html

view details

TJ Mahr

commit sha b46967d20118abc94c2b25b94f5926d26adde14a

Merge branch 'master' of https://github.com/tjmahr/bayesplot-talk

view details

push time in 23 days

push eventtjmahr/bayesplot-satrdays-2019

TJ Mahr

commit sha 383942fd0d9c1a6198701e4348b6c4c1c885f7f9

Delete another-race.R

view details

push time in 23 days

push eventtjmahr/bayesplot-satrdays-2019

TJ Mahr

commit sha 2b9ca95d0a205cc82b2fbd706f5804239a74123a

add slides

view details

push time in 23 days

push eventtjmahr/bayesplot-satrdays-2019

TJ Mahr

commit sha 5d4c53a31fc4d736a0fcccf19346d5ad3a8b90de

Update README.md

view details

push time in 23 days

push eventtjmahr/bayesplot-talk

TJ Mahr

commit sha d64b17a3abd0f8dc866cf9cd87b4bbfe91a21eb8

fill in final placeholders

view details

push time in 24 days

push eventtjmahr/bayesplot-talk

TJ Mahr

commit sha 2124b796733f2d07a7567a183de4895006fe13e0

use iframes

view details

push time in 24 days

push eventtjmahr/bayesplot-talk

TJ Mahr

commit sha dc887f18927cf254c99b793ff45ad6a0e6a13dcd

Add placeholders to start and beginning

view details

push time in 25 days

push eventtjmahr/bayesplot-talk

TJ Mahr

commit sha f1bbd344057d00674d02abacaaf7c1e7e06605e2

Tweak some styles

view details

push time in 25 days

push eventtjmahr/bayesplot-talk

TJ Mahr

commit sha 07af994f3f248b1af2eadf65687fae633b34b350

Started converting to reveal.js

view details

push time in 25 days

startedRomuloOliveira/commit-messages-guide

started time in a month

startednwstephens/rmdcss

started time in a month

startedleeper/colourlovers

started time in a month

startedyeukyul/lindia

started time in a month

startedmbonsma/lefty-longevity

started time in a month

push eventtjmahr/bayesplot-talk

TJ Mahr

commit sha 2978bbff91da238d07f94ea64565cf3217a2a6ed

work on bullets

view details

push time in a month

push eventtjmahr/bayesplot-talk

TJ Mahr

commit sha b57917ac80bbae212ca7427071d1dbe91f51907b

races

view details

push time in a month

push eventtjmahr/bayesplot-talk

TJ Mahr

commit sha 62dabfbc1a8d6d4145e357cc40ead84a3c900c91

snapshot

view details

push time in a month

create barnchtjmahr/bayesplot-talk

branch : master

created branch time in a month

created repositorytjmahr/bayesplot-talk

created time in a month

startedmikolajdobrucki/ikonate

started time in a month

startedeasystats/report

started time in a month

startedmarkusschanta/awesome-jupyter

started time in a month

startedmtdvio/every-programmer-should-know

started time in a month

startedAnneCollins/TenSimpleRulesModeling

started time in a month

startedChris-Engelhardt/data_sci_guide

started time in a month

startedEmilHvitfeldt/gganonymize

started time in a month

startednoamross/datacamp-sexual-assault

started time in a month

startedkognise/water.css

started time in a month

startedeasystats/bayestestR

started time in a month

startedmdlincoln/docthis

started time in a month

starteduswds/public-sans

started time in a month

startedmikedecr/causal-bayes

started time in a month

startedelinlarsen/WordSegComprehension

started time in a month

issue commentstan-dev/bayesplot

Exclude parameters (eg: "lp__")

I don't mind pars_drop and regex_pars_drop.

My ideal design would be something like vars()/tidyselect, so that vars(x, y) would select x and y and vars(-x, -matches("beta")) would drop x and anything matching the regex "beta".

aornugent

comment created time in a month

issue commentstan-dev/bayesplot

Always call `as.matrix` or `as.array` on the first argument

Right.

  • as.array() on a valid array... safe
  • as.array() on an object with an as.array() method... safe.
  • as.array() on anything else... as.array.default() adds a dim attribute. we reject if it doesn't have valid dimensions.
bgoodri

comment created time in a month

more