logLik.angmcmc {BAMBI}R Documentation

Extract Log-Likelihood from angmcmc objects

Description

Extract Log-Likelihood from angmcmc objects

Usage

## S3 method for class 'angmcmc'
logLik(object, method = 1, fn, ...)

Arguments

object

angular MCMC object.

method

interger specifying method of estimating the log likelihood. Must be 1 or 2. Defaults to 1. See details.

fn

function to evaluate on the iteration-wise log-likelihood values obtained during MCMC run if method = 1; or, if method = 2, function to evaluate on the MCMC samples for parameter estimation (passed to pointest). Defaults to max if method = 1 and mean if method = 2.

...

additional arguments to be passed to the function.

Details

There are two ways to estimate the log likelihood from the model. If method = 1, then log likelihood is estimated by applying fn (defaults to max, if method = 1) direclty on the log likelihood values from observed during the MCMC run. On the other hand, if method == 2, then parameter estimates are first computed using pointest with fn (defaults to "MODE", if method == 2) applied on the MCMC samples, and then then log likelihood is evaluated at the parameter estimates.

The degrees of the likelihood function is the total number of free parameters estimated in the mixture models, which is equal to 6K - 1 for bivariate models (vmsin, vmcos and wnorm2), or 3K - 1 for univariate models (vm and wnorm), where K denotes the number of components in the mixture model.

Value

Returns an object of class logLik. This is a number (the estimated log likelihood) with attributes "df" (degrees of freedom) and "nobs" (number of observations).

Examples

# illustration only - more iterations needed for convergence
fit.vmsin.20 <- fit_vmsinmix(tim8, ncomp = 3, n.iter =  20,
                             n.chains = 1)
logLik(fit.vmsin.20)

[Package BAMBI version 2.3.5 Index]