calc_ll | R Documentation |
Calculate the log-likelihood of the posterior predictive distribution
calc_ll(x, response, upper = NA, censored = NULL, cens = TRUE)
x |
A dataframe of posterior predictions. |
response |
The name of the response variable. |
upper |
For interval censoring, the upper bound ( |
censored |
The name of the censoring indicator. |
cens |
Logical. Is the response censored? |
A matrix of log-likelihoods.
library("brms")
seed <- 1
data <- read.csv(paste0(system.file("extdata", package = "bgamcar1"), "/data.csv"))
fit <- fit_stan_model(
paste0(system.file("extdata", package = "bgamcar1"), "/test"),
seed,
bf(y | cens(ycens, y2 = y2) ~ 1),
data,
prior(normal(0, 1), class = Intercept),
car1 = FALSE,
save_warmup = FALSE,
chains = 3
)
ll_in <- add_pred_draws_car1(data, fit, draw_ids = 1:10, car1 = FALSE)
calc_ll(ll_in, "y", "y2", "ycens")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.