statnet / ergm

Fit, Simulate and Diagnose Exponential-Family Models for Networks
Other
94 stars 36 forks source link

ERGM crashes when fitting MCMC: "Error in T2nullity && verbose : invalid 'x' type in 'x && y'" #503

Closed matwurst closed 1 year ago

matwurst commented 1 year ago

Dear all,

I will keep it short since it's late at night, but every time my models start to fit the model, it crashes with the following error:

Iteration 16 of at most 60:
Optimizing with step length 1.0000.
The log-likelihood improved by 0.0826.
Error in T2nullity && verbose : invalid 'x' type in 'x && y'

anyone has an idea where this comes from?

This is my code:

model <- ergm(mixed.recht ~ edges + +gwesp(0.25,fixed=T) + nodefactor("var1") + ...)
mbojan commented 1 year ago

This seems to be, roughly speaking, a numerical problem in the estimation. It is hard to say whether we have a problem with the software or something is wrong with your data, or the model specification vis a vis your data. We'd need a reproducible example, can you provide one?

matwurst commented 1 year ago

Dear mbojan, can be closed. I updated the ERMG-package and found that one covar semed to have crashed the code.

cbccbcc commented 1 year ago

I encountered the same issue but a slightly different one. When I was coding like:

gw1_sup <- ergm(supnet ~ edges + nodefactor("edu") + nodefactor("income") + 
nodefactor("work") +  nodefactor("religious") + nodefactor("gender") + nodecov("age") + 
edgecov(kin_sup,"kinweight") + gwidegree(.1, T) + gwesp(.1, T) + gwdsp(.1, T), 
control = control.ergm(MCMC.samplesize = 1e+5, MCMC.burnin = 1e+6, MCMC.interval = 1000, seed = 567), 
eval.loglik = T, verbose = T)

everything is okay. But when I turned the "edu" and "income" to continuous variables and code like:

gw1_sup <- ergm(supnet ~ edges + nodefactor("work") +  nodefactor("religious") + 
nodefactor("gender") + +nodecov("edu") + nodecov("income") + nodecov("age") + 
edgecov(kin_sup,"kinweight") + gwidegree(.1, T) + gwesp(.1, T) + gwdsp(.1, T), 
control = control.ergm(MCMC.samplesize = 1e+5, MCMC.burnin = 1e+6, MCMC.interval = 1000, seed = 567), 
eval.loglik = T, verbose = T) )

, at first it went okay but at around 8/9 iteration the ergm collapsed and report the same error in this issue. I don't know why :(

xxhandup commented 10 months ago

Dear matwurst, May I ask how you solved it? Just updated ergm's package? Have other matching packages been updated? Which version has it been updated to? Thank you very much

cbccbcc commented 10 months ago

If I recall right, I used "ergm.tapered" instead of "ergm" and solve it, maybe updating the package would help )

xxhandup commented 10 months ago

Thank your reply. I will try it.