TO DO: implement using fitted()
and predict()
but avoid double-computing the samples? E.g.:
get_quantiles2 = function(fit, quantiles, facet_by = NULL) {
fitted(fit, probs = c(0.1, 0.5, 0.9), newdata = data.frame(x = c(11, 50, 100))) %>%
tidyr::pivot_longer(tidyselect::starts_with("Q")) %>%
dplyr::mutate(quantile = stringr::str_remove(name, "Q") %>% as.numeric() / 100)
}
get_quantiles(samples, quantiles, xvar, yvar, facet_by = NULL)
A tidybayes long format tibble with the column "quantile"
A tidybayes tibble
Vector of quantiles (0.0 to 1.0)
An rlang::sym() with the name of the x-col in samples
An rlang::sym() with the name of the response col in samples
String. Name of a varying group.
Jonas Kristoffer Lindeløv jonas@lindeloev.dk