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.
parameter_name: The name of the log-likelihood parameter in the Stan output; ignored when object is a ubmsFit
merge_chains: If TRUE (the default), all Markov chains are merged together (i.e., stacked) and a matrix is returned. If ‘FALSE’ they are kept separate and an array is returned.
Returns
A matrix (samples x sites) or array (samples x chains x sites)