From 7f5f730935ad76b168c6a18ebb0f9facb73f21a8 Mon Sep 17 00:00:00 2001 From: athowes Date: Tue, 30 Jul 2024 15:05:55 +0100 Subject: [PATCH] Begin working on delay_samples functionality --- R/delay-samples.R | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 R/delay-samples.R diff --git a/R/delay-samples.R b/R/delay-samples.R new file mode 100644 index 000000000..19c5d43c1 --- /dev/null +++ b/R/delay-samples.R @@ -0,0 +1,17 @@ +delay_samples <- function(fit) { + dpars <- fit$family$dpars + lp_mu <- brms::posterior_linpred(fit, transform = TRUE, dpar = dpars[1]) + lp_sigma <- brms::posterior_linpred(fit, transform = TRUE, dpar = dpars[2]) + + # lp_mu <- brms::posterior_linpred(fit, transform = TRUE, dpar = "mu") |> + # as.table() |> + # as.data.table() + # names(lp_mu) <- c("draw", "index", "mu") + # lp_sigma <- brms::posterior_linpred(fit, transform = TRUE, dpar = "sigma") |> + # as.table() |> + # as.data.table(value.name = "sigma") + # names(lp_sigma) <- c("draw", "index", "sigma") + # lp <- dplyr::left_join(lp_mu, lp_sigma) + # class(lp) <- c(class(lp), "lognormal_samples") + # x <- add_mean_sd(lp) +}