logLik.ergm {ergm}R Documentation

A logLik method for ergm

Description

A function to return the log-likelihood associated with an ergm fit, evaluating it if necessary.

Usage

## S3 method for class 'ergm'
logLik(object, nsteps = 20, add = FALSE, force.reeval =
FALSE, eval.loglik = add || force.reeval, ...)

Arguments

object

An ergm fit, returned by ergm.

nsteps

Number of bridges for bridge sampling estimation.

add

Instead of returning the log-likelihood, return object with log-likelihood value set.

eval.loglik

Evaluate the log-likelihood if not set on object.

force.reeval

Whether to reestimate the log-likelihood even if object already has an estiamte. Defaults to FALSE.

...

Other arguments to the bridge sampling functions.

Details

If the log-likelihood was not computed for object, produces an error unless eval.loglik=TRUE

Value

If add=FALSE (the default), a logLik object. If add=TRUE (the default), an ergm object with the log-likelihood set.

References

Hunter, D. R. and Handcock, M. S. (2006) Inference in curved exponential family models for networks, Journal of Computational and Graphical Statistics.

See Also

logLik, ergm.bridge.llr, ergm.bridge.dindstart.llk

Examples

# See help(ergm) for a description of this model:
data(florentine)
gest <- ergm(flomarriage ~ kstar(1:2) + absdiff("wealth") + triangle)
# Log-likelihood is not evaluated, so no deviance, AIC, or BIC:
summary(gest)
# Evaluate the log-likelihood and attach it to the object.
gest <- logLik(gest, add=TRUE)
# Deviances, AIC, and BIC now shown:
summary(gest)

[Package ergm version 2.4-3 Index]