[statnet_help] Likelihood and AIC from mtergm() in the btergm package by Leifeld

Leifeld, Philip philip.leifeld at essex.ac.uk
Sat Feb 22 08:04:25 PST 2020

Hi Darren,

While the btergm function implements a bootrapping correction to MPLE
standard errors in a TERGM (i.e., for a panel of many networks), mtergm
is just a convenience wrapper for the ergm::ergm function with MCMLE
(i.e., for few waves) based on a block-diagonal matrix with an offset
term. The original ergm object is stored inside the output, and you can
access it via mtergm.model at ergm. However, the ergm package does not seem
to define a working logLik method for models with an offset term, hence
logLik(mtergm.model at ergm) does not seem to work. Upon inspecting a
fitted model, I can see that a log likelihood value is stored in the
$loglikelihood slot. Provided that this is indeed the log likelihood,
which the statnet developers should be able to confirm, I suppose you
may be able to calculate the desired quantities as follows:

ll <- as.numeric(mtergm.model at ergm$loglikelihood)
aic <- -2 * ll + (2 * length(mtergm.model at ergm$coef))
bic <- -2 * ll + (2 * log(nobs(mtergm.model at ergm)))

That said, I am not sure how well-defined BIC is in a network context
given its reliance on the number of observations, which is perhaps
ambiguous in a network context.

If you have any follow-up questions, please feel free to email me
directly or add an entry to the issue tracker for the btergm package on
GitHub: https://github.com/leifeld/btergm/issues

Best regards,


Professor of Comparative Politics
Department of Government
University of Essex

On 21/02/2020 15:13, Darren Gillis wrote:

> Hello,



> I am not sure if this is the correct place to post regarding btergm, but

> I thought I'd try as other related posts appear in the archives.



> I am currently working with a dynamic network (four annual

> cross-sections) of vessel associations in a North Sea trawl fishery. I

> am exploring both tergm::stergm() and btergm::mtergm() as alternative

> modeling methods. I am interested in using AIC to compare alternative

> models within (not between) each of these packages (in addition to

> examining  MCMC chains, checking degeneracy and GOF). I can easily

> extract these values from stergm(), but in mtergm() the S4 slots for

> likelihood, aic, and bic mtergm are all NA. In addition, attempts to

> directly obtain these values with "AIC(mtergm.model) " result in:



> Error in UseMethod("logLik") : no applicable method for 'logLik' applied

> to an object of class "mtergm"




> Are these slots place holders for compatibility with other packages or

> have I missed something in the manual and associated publication

> (Leifeld et al. 2018)?   I think the answer is pretty clear, but I

> wanted to double check before I moved on. Thank you for considering my

> query.



> Dr. Darren M. Gillis

> Professor, Biological Sciences

> Faculty of Science

> University of Manitoba


> “Ignorance more frequently begets confidence than does knowledge.”

> ― Charles Darwin



> "...,  reality must take precedence over public relations, for Nature

> cannot be fooled."

> ― Richard P. Feynman




More information about the statnet_help mailing list