samplestats: Sampling Statistics

View source: R/BAMLSS.R

samplestatsR Documentation

Sampling Statistics

Description

The function computes the average the log-likelihood, log-posterior, the deviance information criterion and estimated degrees of freedom from samples of, e.g., a bamlss object.

Usage

samplestats(samples, x = NULL, y = NULL,
  family = NULL, logLik = FALSE, ...)

Arguments

samples

An object of class "mcmc.list" or "bamlss" which contains MCMC samples.

x

The x list as returned by function bamlss.frame.

y

The model response, as returned by function bamlss.frame

family

A bamlss.family object.

logLik

Logical, should the log-likelihood be computed, may take some time!

...

Currently not used.

Details

If the log-likelihood is not available in the samples, the function tries to compute the information. Depending on the complexity of the model, this may take some time. Computations are based on the $d() or $loglik() function of the bamlss.family object.

If a bamlss.family object contains a function $p2d() or $p2loglik(), which computes the log-likelihood from parameters, these functions are used for computation.

Value

A list with the following entries (if available):

logLik

The average log-likelihood.

logPost

The average log-posterior.

DIC

The deviance information criterion.

pd

The estimated degrees of freedom.

See Also

bamlss

Examples

## Not run: ## Generate some data.
d <- GAMart()

## Estimate model without sampling statistics
b <- bamlss(num ~ s(x1) + s(x2) + s(x3) + te(lon,lat),
  data = d, samplestats = FALSE)

## Note: needs the $d() or $loglik() function in the family!
names(family(b))

## Compute sampling statistics.
samplestats(b)

## End(Not run)

bamlss documentation built on Oct. 11, 2024, 5:07 p.m.