-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
variance(<draws_array>)
method for changing default method in {distributional}
#219
Comments
Ah --- this was what we had hoped would be solved with mitchelloharawild/distributional#55 --- the old output you've given above is also incorrect because it uses I think the reason it didn't fix it is just because the classes for #' @rdname variance
#' @export
variance.array <- variance.numeric Which in a quick test I made now solves the problem for us: x <- example_draws("eight_schools")
summarise_draws(x, var = distributional::variance)
|
I think I'd prefer to be conservative with the behaviour of |
We can, though I would argue the interface you have has already made a choice re: arrays: the x = array(1:10, dim = c(1,2,5))
class(x)
## [1] "array"
variance(x)
## [1] 9.166667
class(x) = c("foo","array")
variance(x)
## Error in variance.default(x) :
## The variance() method is not supported for objects of type c("foo", "array") So adding the Anyway, if you still would rather not we can add the draws_array generic here. :) |
Thanks - on reflection I'm starting to think that The I'm not sure how this extends to arrays, but I doubt giving a single variance is best. So at this stage I think a draws_array method is safest. |
Makes sense, I'll put together a PR for |
Looks like the changes in mitchelloharawild/distributional#55 to the default method for
variance()
has caused problems with{posterior}
.Would you like to add a method for
variance(<draws_array>)
or swap outdistributional::variance
forvar
in examples and tests?Created on 2021-12-01 by the reprex package (v2.0.0)
The text was updated successfully, but these errors were encountered: