Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for posterior package #518

Merged
merged 4 commits into from
Apr 5, 2022
Merged

Conversation

strengejacke
Copy link
Member

Description

This PR aims at adding this feature...

Proposed Changes

I changed the foo function so that ...

@strengejacke
Copy link
Member Author

@DominiqueMakowski you may merge if everything works.

I mostly copied data frame methods to create the .draws methods, so we support the posterior package now.

Copy link
Member

@mattansb mattansb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@mjskay
Copy link

mjskay commented Apr 3, 2022

I followed this over from stan-dev/posterior#216. Very cool to see support for {posterior} here!

I noticed that the .posterior_draws_to_df() helper doesn't have an implementation for the "draws_rvars" format. You should be able to do something like this:

.posterior_draws_to_df.draws_rvars <- function(x) {
  .posterior_draws_to_df(posterior::as_draws_df(x))
}

Alternatively you might replace all of the format-specific implementations of .posterior_draws_to_df() with something like this:

.posterior_draws_to_df <- function(x) {
  datawizard::data_remove(as.data.frame(posterior::as_draws_df(x)), c(".chain", ".iteration", ".draw"))
}

Which would eliminate the need to test/maintain those functions here and make you future-proof to any changes in posterior formats.

@strengejacke
Copy link
Member Author

Thanks @mjskay, I used your latter approach, which indeed seems more stable, also regarding potential future changes.

@DominiqueMakowski DominiqueMakowski merged commit 6ec2e9f into master Apr 5, 2022
@DominiqueMakowski DominiqueMakowski deleted the posterior_pkg branch April 5, 2022 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants