基于R中传递权的有值有向ERGM建模

yacmzcpb  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(149)

我目前正在使用R中的ergm.count包来建模一个有值有向网络。邻接矩阵可以通过这个link下载。这个网络由84个节点和75个加权关系组成。

library(ergm.count)
mat <- as.matrix(read.csv("./mat.csv",header=TRUE)[,-1])
net<-as.network(mat , directed=TRUE, matrix.type="a", 
                      ignore.eval=FALSE, names.eval="cnts"
                     )
m1<-ergm(net~ transitiveweights("min", "max", "min"),
         reference=~Poisson,
         response="cnts",
         control=control.ergm(parallel=6, parallel.type="PSOCK",
                              main.method="MCMLE")
)

字符串
然而,当我运行上面的代码时,进度感觉就像永远卡住了一样,CPU负载真的很高。
x1c 0d1x的数据
我不知道发生了什么,我的代码有什么问题。有什么方法可以加快或优化进度。顺便说一下,我的R版本是4.3.2,ergm版本是4.5.0,这里是合适的输出...

Starting contrastive divergence estimation via CD-MCMLE:
Iteration 1 of at most 60:
Convergence test P-value:1.5e-04
The log-likelihood improved by 0.07426.
Iteration 2 of at most 60:
Convergence test P-value:6.2e-03
The log-likelihood improved by 0.03396.
Iteration 3 of at most 60:
Convergence test P-value:5.9e-01
Convergence detected. Stopping.
The log-likelihood improved by 0.001075.
Finished CD.
Starting Monte Carlo maximum likelihood estimation (MCMLE):
Iteration 1 of at most 60:


编辑:
经过三个小时的等待与日志打印,该过程停止,并显示:

> source("/root/transfer_analysis/test.R", encoding = "UTF-8")
Evaluating network in model.
Initializing unconstrained Metropolis-Hastings proposal: ‘ergm.count:MH_DiscTNT’.
Initializing model...
Model initialized.
Using initial method 'CD'.
Fitting initial model.
Starting contrastive divergence estimation via CD-MCMLE:
Iteration 1 of at most 60:
Convergence test P-value:1.5e-06
The log-likelihood improved by 0.1578.
Iteration 2 of at most 60:
Convergence test P-value:2.6e-02
The log-likelihood improved by 0.02119.
Iteration 3 of at most 60:
Convergence test P-value:4.6e-01
The log-likelihood improved by 0.002026.
Iteration 4 of at most 60:
Convergence test P-value:1e-01
The log-likelihood improved by 0.01116.
Iteration 5 of at most 60:
Convergence test P-value:1.4e-01
The log-likelihood improved by 0.007586.
Iteration 6 of at most 60:
Convergence test P-value:1e+00
Convergence detected. Stopping.
The log-likelihood improved by < 0.0001.
Finished CD.
Starting Monte Carlo maximum likelihood estimation (MCMLE):
Density guard set to 10000 from an initial count of 75 edges.

Iteration 1 of at most 60 with parameter:
transitiveweights.min.max.min 
                    -1.483437 
Starting unconstrained MCMC...
Back from unconstrained MCMC.
Error in ergm.MCMLE(init, s, s.obs, control = control, verbose = verbose,  : 
  Unconstrained MCMC sampling did not mix at all. Optimization cannot continue.
Additional warning message:
In ergm_MCMC_sample(s, control, theta = mcmc.init, verbose = max(verbose -  :
  Unable to reach target effective size in iterations alotted.


我已经检查了另一个关于“无法在迭代中达到目标有效大小”的问题,但这个拟合模型和公式似乎很简单
任何帮助将不胜感激!

zpjtge22

zpjtge221#

我怀疑估计会因为模型规格而卡住。我建议您在拟合复杂模型(例如transitiveweights模型)之前探索数据。我不知道您试图建模的系统是什么,所以显然下面的内容是物质不可知的:
1.看看边缘值分布的形状,泊松参考测度是正确的规范吗?
1.试着拟合简单的模型,从一个齐次模型开始,也就是说,只有一个常数(例如sum)。这些模型是否适合数据,如果不是,如何?
1.也许带有transitiveweights的模型也应该有sum
1.你有任何节点协变量,可以用来模拟网络旁边的三元效应,你有?

相关问题