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

Darren Gillis Darren.Gillis at umanitoba.ca
Sat Feb 22 09:06:23 PST 2020

Hi Philip,

Thank you for your rapid reply! This is very helpful.

First, I apologize for stating that the likelihood, aic, and bic slots contain NA when in fact they contain NaN. The same issue for me, but it could be important (or misleading) for someone trying to determine the root of the issue.

Especially, I want to thank you also for the quick AIC hack. It will serve my purposes for now, but I will wait for input from the statnet team on the meaning of ergm$likelihood before I use these values in my manuscript. And I always have the auc.pr values across the panel of networks. In fact, it may be just as good for my goal, but AIC is more familiar for most fisheries reviewers.

I am exploring both your package and STERGMs for this dynamic network, and I greatly appreciate the work that you and the statnet team have placed in your packages.

Warmest regards, Darren

Dr. Darren M. Gillis
Professor, Biological Sciences
Faculty of Science
University of Manitoba

From: Leifeld, Philip <philip.leifeld at essex.ac.uk>
Sent: February 22, 2020 10:04 AM
To: statnet_help at u.washington.edu
Cc: Darren Gillis
Subject: Re: [statnet_help] Likelihood and AIC from mtergm() in the btergm package by Leifeld

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




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman13.u.washington.edu/pipermail/statnet_help/attachments/20200222/83588c05/attachment.html>

More information about the statnet_help mailing list