extract_log_lik {ubms} | R Documentation |
Extract Pointwise Log-likelihood From Model
Description
Extracts the pointwise log-likelihood matrix or array from a model.
This is useful as an input for functions in the loo
package.
If called on a ubmsFit
object, the log-likelihood matrix or array
is calculated using the posterior distributions of the parameters; the
log-likelihood values are not actually saved inside the model object.
If called on a stanfit
object, loo::extract_log_lik
is used.
In this case, the log-likelihood must be saved as one of the output
parameters in Stan.
Usage
extract_log_lik(object, parameter_name = "log_lik", merge_chains = TRUE)
Arguments
object |
A |
parameter_name |
The name of the log-likelihood parameter in the
Stan output; ignored when |
merge_chains |
If |
Value
A matrix (samples x sites) or array (samples x chains x sites)