提问人:Sulz 提问时间:11/18/2023 更新时间:11/18/2023 访问量:15
R breacks when usinig ergm
R breacks when usinig ergm
问:
I have a big network and always when I run the ergm Modell, R breacks down. (In the mean while It shows high memory use).
Anyone an idea what I could do?
library(network)
library(ergm)
gc()
model.1a <- ergm(net[[1]] ~ edges()+nodecov("dist2coast")+nodecov("dist2rail60")+nodecov("dist2paved")+edgecov(dist_matrix),
control = control.ergm(
seed = 1,
MCMLE.maxit = 10,
parallel = 4,
CD.maxit = 10))
net[[1]]
Network attributes:
vertices = 7819
directed = FALSE
hyper = FALSE
loops = FALSE
multiple = FALSE
bipartite = FALSE
total edges= 273
missing edges= 0
non-missing edges= 273
Vertex attribute names:
agglosID agglosName builtUp capital class1 class2 class3 dist2capital dist2coast dist2emst dist2first dist2impr dist2paved dist2placebo16 dist2placebo22 dist2rail60 dist2rail60mil dist2rail60min dist2river dist2second first geometry ISO3 L1 Latitude Longitude mean2010 Metropole nodeID.1 notown Pop1950 Pop1960 Pop1970 Pop1980 Pop1990 Pop2000 Pop2010 Pop2015 prec_mean second sparseveg undetermined vertex.names Voronoi water
No edge attributes
答:
1赞
Michał
11/21/2023
#1
Couple of issues here:
- In the model formula write without parentheses.
edges
- Your network is extremely sparse -- 273 edges among 7819 nodes. That's network density in the order of 10^(-4). Are you sure it is correct?
- We have worked with networks with 100k nodes, but you need RAM for that. Does your computer have enough RAM?
- You are fitting a dyad-independent model. Such model simplifies to a logit GLM, but fitted to quite a big model matrix, especially that you have a term with a matrix that is 7819 x 7819. Still, MCMC is not used thus (1) you dont need MCMC and CD control parameters and (2) the "breaking of R" you are experiencing is not due to Markov chains going astray.
edgecov
- Try re-running the estimation with to and update your question with the messages it produces. Otherwise it is hard to deduce what's going on with the estimation.
verbose=TRUE
ergm()
评论
0赞
Sulz
11/21/2023
Thank you for your reply. That helps in the first instance. I will test all of your suggestions in the afternoon. To 1) Thanks. 2) yes (net[[1]] is the first, and ints getting denser till net[[5]]) 2) do you have an estimate how much I will need (I guess my ram is to small (8GB) but I have a possibility to test it on 64 GB ram -enough? 4/5) thanks!
0赞
Michał
11/22/2023
I don't really have an estimate, but for this model and this data i'd guess 8GB should be more than enough.
评论