我正在使用ergm
中的R
包来探索网络数据的指数随机图模型。这是网络:
gn
Network attributes:
vertices = 678
directed = TRUE
hyper = FALSE
loops = FALSE
multiple = FALSE
bipartite = FALSE
total edges= 1663
missing edges= 0
non-missing edges= 1663
Vertex attribute names:
indegree membership num_tweets vertex.names
Edge attribute names not shown
在拟合更简单的模型后,其中一个术语为edges
和mutual
,一个术语为edges
,mutual
和nodefactor("membership", base = 4)
(其中{{1}这是一个有四个级别的因素),我适合添加了membership
的模型,如下所示:
nodematch("membership", diff = T)
虽然以前的模型融合了,但这个模型导致了这个信息:
model1 <- ergm(gn ~ edges +
mutual +
nodefactor("membership", base = 4) +
nodematch("membership", diff = T)
)
根据指示,我查看了MCMLE estimation did not converge after 20 iterations. The estimated coefficients may not be accurate. Estimation may be resumed by passing the coefficients as initial values; see 'init' under ?control.ergm for details.
:?control.ergm
好的,这听起来不错,我搜索了Passing control.ergm(init=coef(prev.fit)) can be used to “resume” an uncoverged ergm run, but see enformulate.curved.
的使用方式,并从this page找到了一个例子,我通过传递control.ergm
作为参数测试了这是否有效,将control = control.ergm(MCMLE.maxit = 50)
从20增加到50.然后我执行了以下操作:
number of times the parameters for the MCMC should be updated by maximizing the MCMC likelihood
但是,会返回此消息:model1a <- ergm(gn ~ edges +
mutual +
nodefactor("membership", base = 4) +
nodematch("membership", diff = T),
control = control.ergm(init=coef(prev.fit))
)
。
我还试图传递模型对象(即Error in coef(prev.fit) : object 'prev.fit' not found
)而不是model1a
,但这导致了这个效率不高的错误:
prev.fit
那么,如何通过传递Error in if (drop) { : argument is not interpretable as logical
In addition: Warning message:
In if (drop) { :
the condition has length > 1 and only the first element will be used
或通过不同的方法“恢复”未拥挤的模型?