tidybayes.rethinking icon indicating copy to clipboard operation
tidybayes.rethinking copied to clipboard

Extend `predicted_draws()` to handle `sim()` calls using `vars` argument

Open jonathan-g opened this issue 3 years ago • 0 comments

As issue #15 reports, rethinking::sim(model, new_data, vars = c("foo", "bar")) returns a named list of matrices: one for "foo" and one for "bar" as dependent variables. predicted_draws() expects sim() to return a single matrix, so predicted_draws(model, new_data, vars = c("foo", "bar")) throws an error.

This patch has predicted_draws() test for whether sim() returns a list, and if so, it returns a named list of data.frames, one for each matrix in the list returned by sim().

jonathan-g avatar Sep 18 '22 21:09 jonathan-g