View source: R/bayesian_helpers.R
log_likelihood | R Documentation |
Calculate log likelihood (LLK)
log_likelihood(.samples, .func, .args, .l_targets)
.samples |
A table or vector of sampled parameter values |
.func |
A function defining the model to be calibrated |
.args |
A list of arguments to be passed to .func |
.l_targets |
A list containing a vector of targets' names, a vector of targets' weights, a vector of targets' distributions, and a table for each target that contains the values (column name 'value') and standard errors (column name 'sd') of the corresponding target. |
A table with proposed parameter sets and their corresponding summed overall likelihood values sorted in descending order.
## Not run:
library(calibR)
data("CRS_targets")
Surv <- CRS_targets$Surv
v_targets_names <- c("Surv")
v_targets_dists <- c('norm')
v_targets_weights <- c(1)
l_targets <- list('v_targets_names' = v_targets_names, 'Surv' = Surv,
'v_targets_dists' = v_targets_dists,
'v_targets_weights' = v_targets_weights)
v_params_names <- c("p_Mets", "p_DieMets")
v_params_dists <- c("unif", "unif")
args <- list(list(min = 0.04, max = 0.16),
list(min = 0.04, max = 0.12))
l_params = list(v_params_names = v_params_names,
v_params_dists = v_params_dists,
args = args)
samples <- sample_prior_LHS(.l_params = l_params,
.n_samples = 10)
l_lik <- log_likelihood(.func = CRS_markov, .args = NULL,
.samples = samples, .l_targets = l_targets)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.