tidybayes.rethinking
tidybayes.rethinking copied to clipboard
Extend `predicted_draws()` to handle `sim()` calls using `vars` argument
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().