logLik.network_histogram: Log-likelihood of network histogram fits

View source: R/logLik.R

logLik.network_histogramR Documentation

Log-likelihood of network histogram fits

Description

Extracts the Bernoulli log-likelihood of a fitted network histogram. The method is defined on the common base class, so it applies to nethist, multinethist, and hnethist objects alike; see network_histogram-class.

Usage

## S3 method for class 'network_histogram'
logLik(object, normalized = FALSE, ...)

Arguments

object

a network_histogram object, that is, a fit returned by nethist, multinethist, or hnethist.

normalized

logical. If FALSE (default), the unnormalized log-likelihood is returned as a logLik object. If TRUE, the per-edge normalized value stored in object$normalized_LL is returned as a plain numeric.

...

currently unused.

Details

The normalized value is not given class logLik on purpose. Passing a per-edge normalized value to AIC() or BIC() would return a meaningless number without any error.

The degrees of freedom count the free block probabilities: k * (k + 1) / 2 for nethist, where k is the number of blocks; the same for multinethist fitted with common_f = TRUE, and L times that for L layers otherwise; and s, the number of selected shapes, for hnethist.

The number of observations is the number of Bernoulli edge variables, i.e. n * (n - 1) / 2 for a single layer and L times that for L layers.

The log-likelihood is evaluated at the fitted probability matrix regardless of method, so it is also available for method = "LSE" fits.

Value

With normalized = FALSE, an object of class logLik carrying df and nobs attributes, so that stats::AIC() and stats::BIC() work directly on the fit. With normalized = TRUE, an unclassed numeric equal to object$normalized_LL.

See Also

network_histogram-class, summary.network_histogram

Examples


set.seed(42)
data(polblog)
fit <- suppressMessages(nethist(polblog))
logLik(fit)
logLik(fit, normalized = TRUE)
AIC(fit)
BIC(fit)


nethist documentation built on Oct. 25, 2026, 5:07 p.m.